🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TClientSocket and error events

#3326
From: Stormy
Date: Fri, 14 Oct 2005 12:18
18 lines
1793 bytes
Remy Lebeau (TeamB) wrote:
> 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.

Unfortunately, this is the case where exception is thrown before OnError
event occurs...

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

...so setting ErrorCode to 0 (which I do in this event) does not prevent
exception that already happend.

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

I always thought it's easier and more reliable working with non-blocking
sockets. This is why I avoid using sockets in threads.
Technical Details
Message-ID: <434fa1c3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <434eecdf@newsgroups.borland.com> <434f0102$1@newsgroups.borland.com> <434f5fe5@newsgroups.borland.com> <434f6246$1@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: "Stormy" <s70rmy@hotmail.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <434eecdf@newsgroups.borland.com> <434f0102$1@newsgroups.borland.com> <434f5fe5@newsgroups.borland.com> <434f6246$1@newsgroups.borland.com>
Subject: Re: TClientSocket and error events
Date: Fri, 14 Oct 2005 14:18:29 +0200
Lines: 20
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 193.198.138.91
Message-ID: <434fa1c3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1129292227 193.198.138.91 (14 Oct 2005 05:17:07 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail