Thread View: borland.public.cppbuilder.internet.socket
3 messages
3 total messages
Started by Oleg Tiktinski
Thu, 02 Aug 2007 18:58
Getting Host:Port Pair for connection using TIdTCPServer
Author: Oleg Tiktinski
Date: Thu, 02 Aug 2007 18:58
Date: Thu, 02 Aug 2007 18:58
25 lines
1670 bytes
1670 bytes
Using Borland C++ Builder 2006 with Indy 10.
All my attempts to get Host:Port pair for incoming connection failed,
In serverExecute and serverConnect event handlers I got empty strings.
What I am doing wrong ?
Did anyone know how to obtain host:port pair ?
Thank you!
void __fastcall TPaymentService::tcp_server_serverExecute(TIdContext
*AContext)
{
event_log("host "+AContext->Connection->IOHandler->Host);
}
void __fastcall TPaymentService::tcp_server_serverConnect(TIdContext
*AContext)
{
event_log("port "+IntToStr(AContext->Connection->Socket->Port));
event_log("host "+AContext->Connection->Socket->Host);
event_log("dest "+AContext->Connection->Socket->Destination);
}
Re: Getting Host:Port Pair for connection using TIdTCPServer
Author: Remy Lebeau (TeamB)
Date: Thu, 02 Aug 2007 20:49
Date: Thu, 02 Aug 2007 20:49
19 lines
1538 bytes
1538 bytes
"Oleg Tiktinski" <oleg@sequoiars.com> wrote in message
news:46b22942$1@newsgroups.borland.com...
> What I am doing wrong ?
You are accessing the wrong properties. You need to access the PeerIP and
PeerPort properties of the IOHandler's Binding instead, ie:
void __fastcall TPaymentService::tcp_server_serverConnect(TIdContext
*AContext)
{
event_log("port " +
IntToStr(AContext->Connection->Socket->Binding->PeerPort));
event_log("host " + AContext->Connection->Socket->Binding->PeerIP);
}
Gambit
Re: Getting Host:Port Pair for connection using TIdTCPServer
Author: Oleg Tiktinski
Date: Thu, 02 Aug 2007 21:18
Date: Thu, 02 Aug 2007 21:18
25 lines
1704 bytes
1704 bytes
Ah !
Thanks alot!!!
Remy Lebeau (TeamB) wrote:
> "Oleg Tiktinski" <oleg@sequoiars.com> wrote in message
> news:46b22942$1@newsgroups.borland.com...
>
>> What I am doing wrong ?
>
> You are accessing the wrong properties. You need to access the PeerIP and
> PeerPort properties of the IOHandler's Binding instead, ie:
>
> void __fastcall TPaymentService::tcp_server_serverConnect(TIdContext
> *AContext)
> {
> event_log("port " +
> IntToStr(AContext->Connection->Socket->Binding->PeerPort));
> event_log("host " + AContext->Connection->Socket->Binding->PeerIP);
> }
>
>
> Gambit
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads