Article View: borland.public.cppbuilder.internet.socket
Article #4447Error on reconnection to server
From: Ben
Date: Tue, 08 Feb 2005 15:10
Date: Tue, 08 Feb 2005 15:10
39 lines
2594 bytes
2594 bytes
Hi there!
I've got a little problem on reconnecting to a server.
When the connection is in the air all the time, so the server does not
crash, which is unfortunately not my project, everything works OK.
My system: BCB6 personal running XP-sp1.
Description of my application:
I'm using a client socket in nonBlocking mode.
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;
but this is not working secure, it takes different times to reconnect.
When working in debugmode and stepping through the code reconnection is
almost directly.
Error message generated sometimes, say one in 10 to 20 reconnections:
ESocketError, Windows SocketError, Illegal argument 10022 on API
"WSACancelASyncRequent"
This message is received sometimes at the:
if (ClientSocket->Active)
ClientSocket->Socket->SendBuf((void*)&Message,sizeof(TCPmessageType));
sometimes it is generated in the main unit:
Application->Run();
}
So my question is how can I check and reconnect safely to the server.
Where does the error message come from, what can I do about it. I tried
to use the try {} and catch (...) {;} but this does not work.
If you need more information to help me I can supply this, but before
adding lots of code, this might even be enough.
Thanks very much for your help,
Ben
Technical Details
Message-ID:
<4208d668$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,7304809fda7b8b4e,start X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 08 Feb 2005 16:10:32 +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: Error on reconnection to server Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 80.126.94.138 Message-ID: <4208d668$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1107875432 80.126.94.138 (8 Feb 2005 07:10:32 -0800) Lines: 39 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail