Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TIdUDP get client IP and port


This question is answered.


Permlink Replies: 1 - Last Post: Jan 29, 2018 9:56 AM Last Post By: Remy Lebeau (Te...
James L

Posts: 33
Registered: 8/3/03
TIdUDP get client IP and port  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 29, 2018 1:44 AM
Hello sir,

UDPServerUDPRead(TIdUDPListenerThread *AThread, const TIdBytes AData, TIdSocketHandle *ABinding)

I use TIdUDPServer to receive UDPClinet Data, how to know the client IP and Port?

Thank you,

James
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: TIdUDP get client IP and port
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 29, 2018 9:56 AM   in response to: James L in response to: James L
James L wrote:

I use TIdUDPServer to receive UDPClinet Data, how to know the client
IP and Port?

That information is provided in the PeerIP and PeerPort properties of
the ABinding parameter of the OnUDPRead event:

void __fastcall UDPServerUDPRead(TIdUDPListenerThread *AThread, const
TIdBytes AData, TIdSocketHandle *ABinding)
{
    String ClientIP = ABinding->PeerIP;
    TIdPort ClientPort = ABinding->PeerPort;
    ...
}


--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02