Article View: borland.public.cppbuilder.internet.socket
Article #2342Is there a way to allow an 'ABORT' from a TClientSocket connect?
From: Brian
Date: Wed, 10 May 2006 21:05
Date: Wed, 10 May 2006 21:05
27 lines
1889 bytes
1889 bytes
In my application, the user clicks a button which brings up a
dialog that allows them to specify an IP address and port. This
address should be the address of a piece of equipment. Anyway, when
the user clicks 'Connect' the application creates a new
TClientSocket (nonBlocking) and attempts to connect to it:
socket=new TClientSocket(Application);
socket->ClientType=ctNonBlocking;
socket->Address=Login->Host->Text;
socket->Port=Login->Port->Text.ToIntDef(2024);
socket->OnError=IPSessionError;
socket->OnRead=IPSessionRead;
socket->OnConnect=IPSessionConnect;
socket->Active=true;
During this process, I bring up a 'please wait' dialog that
contains an Abort button.
If the user presses the Abort button, and the application has not
actually made a connection to anything yet (say it's a bad IP
address), how can I force the attempt to close without having
to wait for the timeout?
I've tried setting the socket to inactive (Active=false), but the
OnIPSessionError event still gets called after the timeout period
expires.
Technical Details
Message-ID:
<44625587$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,dfc86feaed00e40,start X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Brian" <brian@nospam.org> Sender: "Brian" <brian@nospam.org> Reply-To: "Brian" <brian@nospam.org> Subject: Is there a way to allow an 'ABORT' from a TClientSocket connect? Newsgroups: borland.public.cppbuilder.internet.socket X-User-Info: 168.127.0.52 X-Forwarded-For: 168.127.162.87 NNTP-Posting-Host: 207.105.83.66 Message-ID: <44625587$1@newsgroups.borland.com> Date: 10 May 2006 14:05:11 -0700 X-Trace: newsgroups.borland.com 1147295111 207.105.83.66 (10 May 2006 14:05:11 -0700) Lines: 27 Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail