🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3325

Re: TClientSocket and error events

#3325
From: Remy Lebeau (TeamB)
Date: Fri, 14 Oct 2005 07:39
27 lines
1761 bytes
"Stormy" <s70rmy@hotmail.com> wrote in message
news:434f5fe5@newsgroups.borland.com...

> OnError event does not get triggered if exception occurs.

For most socket errors, the OnError event is triggered BEFORE an exception
is thrown.  This gives the code a chance to decide whether or not the
exception should be thrown at all.

> Sockets mostly throw exceptions and I have no idea how to omit this.

In the OnError event, set the ErrorCode parameter to 0.

> Prevent socket exceptions from triggering messagebox.

See above.

> Since messagebox requires user interaction (must click OK), and I
> want my application to run in background, logging or showing errors
> other way.

Move the TClientSocket into a worker thread and use it in blocking mode.  It
is easier to handle errors and exceptions that way.


Gambit
Technical Details
Message-ID: <434f6246$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <434eecdf@newsgroups.borland.com> <434f0102$1@newsgroups.borland.com> <434f5fe5@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,bc23240211b4e678
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <434eecdf@newsgroups.borland.com> <434f0102$1@newsgroups.borland.com> <434f5fe5@newsgroups.borland.com>
Subject: Re: TClientSocket and error events
Date: Fri, 14 Oct 2005 00:39:46 -0700
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <434f6246$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1129275974 68.69.17.41 (14 Oct 2005 00:46:14 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail