Article View: borland.public.cppbuilder.internet.socket
Article #4457Re: Error on reconnection to server
From: Ben
Date: Wed, 09 Feb 2005 07:32
Date: Wed, 09 Feb 2005 07:32
41 lines
2174 bytes
2174 bytes
Sorry Hans I misplaced the message see the Remy thread. Tnx Ben Hans Galema wrote: > Ben wrote: > >> I'm using a client socket in nonBlocking mode. > > > A TClientSocket ? > >> The data handling is done in a thread to keep track of the not sent >> packages in a circular buffer and resent them on reconnection. >> I try to reconnect by setting: >> if (!TCPForm->ClientSocket->Active) >> TCPForm->ClientSocket->Active=true; > > > Where and when are you doing that ? > >> if (ClientSocket->Active) >> ClientSocket->Socket->SendBuf((void*)&Message,sizeof(TCPmessageType)); > > > try with > if (ClientSocket->Active && ClientSocket->Socket->Connected ) > ClientSocket->Socket->SendBuf((void*)&Message,sizeof(TCPmessageType)); > >> So my question is how can I check and reconnect safely to the server. > > > Do not reconnect immediately. Give the system time to > process messages and when all is done then first reonnect. > > Hans.
Technical Details
Message-ID:
<4209bc98@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.kamp.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4208d668$1@newsgroups.borland.com> <4208e763$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,7304809fda7b8b4e X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 09 Feb 2005 08:32:42 +0100 From: Ben <TerNOra@etraSPAMde.nl> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: Error on reconnection to server References: <4208d668$1@newsgroups.borland.com> <4208e763$1@newsgroups.borland.com> In-Reply-To: <4208e763$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 80.126.94.138 Message-ID: <4209bc98@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1107934360 80.126.94.138 (8 Feb 2005 23:32:40 -0800) Lines: 41 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.kamp.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail