Article View: borland.public.cppbuilder.internet.socket
Article #2539Re: Bind to a specific port
From: Remy Lebeau (TeamB)
Date: Mon, 20 Mar 2006 00:23
Date: Mon, 20 Mar 2006 00:23
31 lines
1935 bytes
1935 bytes
"Orlando Lopez" <hlopezrd@hotmail.com> wrote in message
news:441de6db@newsgroups.borland.com...
> My problem is that I have an Array of TClientSocket, and when
> the OnLookup event is triggered I have to check the Address and
> the Port number of the current TClientSocket that is in this event to
> bind with an specific port. But the RemoteAddress, LocalAddress,
> LocalPort, RemotePort are all nulls or cero.
As they should be, because the socket is not connected yet when the event is
triggered, and those proerties only work on connected sockets.
> What can I do?
Like every oter event handler in the VCL, the Sender parameter points to the
particular object that is triggering the event - in this case, the
TClientSocket object that you are looking for:
void __fastcall TForm1::ClientSocket1Lookup(TObject *Sender,
TCustomWinSocket *Socket)
{
TClientSocket *Client = dynamic_cast<TClientSocket*>(Sender);
if( !Client )
return;
// ...
}
Gambit
Technical Details
Message-ID:
<441df5e5$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<441de6db@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,36510058f2db75e3 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: <441de6db@newsgroups.borland.com> Subject: Re: Bind to a specific port Date: Sun, 19 Mar 2006 16:23:58 -0800 Lines: 33 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: <441df5e5$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1142814181 68.69.17.41 (19 Mar 2006 16:23:01 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail