🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TClientSocket and error events

#3324
From: Remy Lebeau (TeamB)
Date: Fri, 14 Oct 2005 00:44
39 lines
2423 bytes
"Stormy" <s70rmy@hotmail.com> wrote in message
news:434eecdf@newsgroups.borland.com...

> I have a small problem with client socket. If I set its Host property
> to an unknown host and activate it (either by Open() method or by
> setting it's Active property to true), application throws an exception
> which is handled inside my handler:

You should be using the TClientSocket's OnError event to handle socket
errors.

> Now, the problem is when I now set socket's Host property to existing,
> running host, and open the connection, instead of connecting it throws
> an error via OnError event. Error is, of course, related to prior
connection
> failure to unknown host. OnError event simply does not occur after
> exception being thrown. Exception message is: "Windows socket error: No
> such host is known (11001), on API 'ASync Lookup'" and ErrorCode inside
> OnError event is #10049.

Please show your actual code to reproduce that.  You should not be getting
any error involving the previous Host.

> Is there any way of resetting ErrorCode inside exception handler, and if
so,
> would it prevent socket from triggering an OnError event? My current
solution
> involves setting socket's Active property back to true inside exception
handler
> what causes OnError event to occur for given unknown host connection (I
> moved error logging inside OnError event), but this just doesn't seem to
be
> the right way to solve this problem.

What exactly are you trying to accomplish?


Gambit
Technical Details
Message-ID: <434f0102$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsfeed.gamma.ru!Gamma.RU!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>

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>
Subject: Re: TClientSocket and error events
Date: Thu, 13 Oct 2005 17:44:18 -0700
Lines: 41
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: <434f0102$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1129251074 68.69.17.41 (13 Oct 2005 17:51:14 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsfeed.gamma.ru!Gamma.RU!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail