Article View: borland.public.cppbuilder.internet.socket
Article #4306Re: finding if a port is idle?
From: John Borchers
Date: Fri, 04 Mar 2005 12:56
Date: Fri, 04 Mar 2005 12:56
54 lines
2984 bytes
2984 bytes
Addition to Remy, If you are designing such transfer / recieve you have to specify a good protocol to use. This means at minimum you have some kind of structure for your data package which includes a checksum. Error correction coding would also not be out of the question. John "qyte" <gyte@vivodinet.gr> wrote in message news:42279c95@newsgroups.borland.com... > Remy Lebeau (TeamB) wrote: >> "qyte" <gyte@vivodinet.gr> wrote in message >> news:4227924e$1@newsgroups.borland.com... >> >> >>>Is There a way to find out if a port is idle? >> >> >> Plese elaborate. >> >> >>>i have built a program with 4 clients and a server and i >>>want to syncronize them by checking if the port that >>>they use is idle at a moment so that they can send data. >> >> >> Why do you need to test for idleness before sending data? >> >> >> Gambit >> >> > > The Problem is that when i call SendBuf i want to know for sure if the > data will be sent. apart from that the first socket deals with file > sending through a timer every one millisecond (sends 1kb). I want to add > an abort and even if i close the timer there is still some data on the > winsock that will be sent in the future and of course when the receiver > takes them and calls fwrite then an access violation accurrs. So i want to > know when all the data will have gone and then to send a code that will > signal the abort process. > > As For the first problem i know that i can call sendbuf like that: > > while(sendbuf(a,packet)<0); > > just to be certain that the data was sent. but there is no guarentee that > the whole packet will be sent. > > i am using TServerSocket and TClientSocket. > > i was thinking of using the ClientSocket->LookupState!=isIdle property but > i will have to check all 4 sockets. and i don't know if it will work.
Technical Details
Message-ID:
<42285ae6$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!newsprint.newsread.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4227924e$1@newsgroups.borland.com> <422799a5$1@newsgroups.borland.com> <42279c95@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,3fedec5f2bb3f721 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "John Borchers" <jborchers@notmail.com> From: "John Borchers" <jborchers@notmail.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <4227924e$1@newsgroups.borland.com> <422799a5$1@newsgroups.borland.com> <42279c95@newsgroups.borland.com> Subject: Re: finding if a port is idle? Date: Fri, 4 Mar 2005 07:56:07 -0500 Lines: 56 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 63.116.149.114 Message-ID: <42285ae6$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109940966 63.116.149.114 (4 Mar 2005 04:56:06 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!newsprint.newsread.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail