Article View: borland.public.cppbuilder.internet.socket
Article #5487Re: Exception Handling
From: mike
Date: Tue, 10 Aug 2004 21:49
Date: Tue, 10 Aug 2004 21:49
38 lines
2163 bytes
2163 bytes
Remy, I do have the on error event defined, however the client socket does not create an on error event the first time the open is called with an invalid host. It does the second time it is called, but not the third and so on. So if I use the Client Socket in blocking mode, do I have to create the thread and such as with a blocking ServerSocket. If so do you have sample code that shows what is required. Thanks Mike "Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message news:4119046a$1@newsgroups.borland.com... > > "mike" <mfbrowne@earthlink.net> wrote in message > news:4118e06b@newsgroups.borland.com... > > > Could someone explain to me how to handle an exception > > when trying to open a connection from a TClientSocket. > > If you are using the ClientSocket in non-blocking mode then you can't use > exception handling when calling Open() as any exception thrown will be > delayed, thrown long after Open() returns and your exception handling is > exited. You should use the OnError event to catch errors, and you can > optionally then set the ErrorCode parameter to 0 to prevent exceptions from > being thrown at all. > > Otherwise, use the ClientSocket in blocking mode instead. > > > Gambit > >
Technical Details
Message-ID:
<411944cc$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4118e06b@newsgroups.borland.com> <4119046a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,234111ec25ac0a9d X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "mike" <mfbrowne@earthlink.net> Newsgroups: borland.public.cppbuilder.internet.socket References: <4118e06b@newsgroups.borland.com> <4119046a$1@newsgroups.borland.com> Subject: Re: Exception Handling Date: Tue, 10 Aug 2004 17:49:47 -0400 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 68.204.190.196 Message-ID: <411944cc$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1092175052 68.204.190.196 (10 Aug 2004 14:57:32 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail