Article View: borland.public.cppbuilder.internet.socket
Article #4303Re: finding if a port is idle?
From: qyte
Date: Thu, 03 Mar 2005 23:24
Date: Thu, 03 Mar 2005 23:24
43 lines
2457 bytes
2457 bytes
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:
<42279c95@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!news-out.newsgroups.com!propagator2-sterling.newsfeeds.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>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,3fedec5f2bb3f721 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 04 Mar 2005 01:24:05 +0200 From: qyte <gyte@vivodinet.gr> User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: finding if a port is idle? References: <4227924e$1@newsgroups.borland.com> <422799a5$1@newsgroups.borland.com> In-Reply-To: <422799a5$1@newsgroups.borland.com> Content-Type: text/plain; charset=windows-1253; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.171.210.195 Message-ID: <42279c95@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109892245 83.171.210.195 (3 Mar 2005 15:24:05 -0800) Lines: 43 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail