Article View: borland.public.cppbuilder.internet.socket
Article #4448Re: Error on reconnection to server
From: Hans Galema
Date: Tue, 08 Feb 2005 16:21
Date: Tue, 08 Feb 2005 16:21
27 lines
1837 bytes
1837 bytes
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:
<4208e763$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!newsstand.newsread.com!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>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,7304809fda7b8b4e X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 08 Feb 2005 17:21:39 +0100 From: Hans Galema <notused@notused.nl> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) 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> In-Reply-To: <4208d668$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 129.125.201.248 Message-ID: <4208e763$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1107879779 129.125.201.248 (8 Feb 2005 08:22:59 -0800) Lines: 27 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!newsstand.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail