Article View: borland.public.cppbuilder.internet.socket
Article #5697Re: TServerSocket problems
From: Remy Lebeau (TeamB)
Date: Fri, 09 Jul 2004 18:46
Date: Fri, 09 Jul 2004 18:46
43 lines
2179 bytes
2179 bytes
"Michele Santucci" <michele.santucci.nospam@nospam.celinavio.it> wrote in
message news:40eeb440$1@newsgroups.borland.com...
> 1) I would like to know how to know/set the address
> on wich the TServerSocket listen since
> TServerSocket->Socket->LocalAddress is always
> "0.0.0.0" and is read only.
The easiest way is to derive a new class from TServerSocket and promote the
existing protected Address property to public, ie:
class TMyServerSocket : public TServerSocket
{
public:
__fastcall TMyServerSocket(TComponent Owner) : TServerSocket(Owner)
{}
__property Address;
};
TServerSocket already calls bind() using the Address, but since the Address
is not exposed, it is always empty. Why Borland did not expose it
originally, I do not know.
> 2) I would like also to know how to track the IP address
> of a connected client.
TCustomWinSocket has a RemoteAddress property. All of the event handlers of
TServerSocket have a TCustomWinSocket parameter specifying which client is
triggering each event.
> 3) Last but not least ... is it possible to stop listening after the
> first connection?
No.
> I would like to know how to stop listening WITHOUT closing
> the ongoing connections.
TServerSocket does not support that.
Gambit
Technical Details
Message-ID:
<40eee7f3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40eeb440$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,133ba4102b593f76 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <40eeb440$1@newsgroups.borland.com> Subject: Re: TServerSocket problems Date: Fri, 9 Jul 2004 11:46:42 -0700 Lines: 45 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.10 Message-ID: <40eee7f3$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1089398771 68.69.17.10 (9 Jul 2004 11:46:11 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail