Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Mar : Re: UDP sends arbitrary port
| Subject: | Re: UDP sends arbitrary port |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Wed, 29 Mar 2006 13:20:55 |
"Craig" <craig@radicalage.com> wrote in message
news:442ae4c9$1@newsgroups.borland.com...
> Is there any way I can assign the local port when sending a UDP packet?
Like any other socket, a UDP socket can be bound to a local IP and a local
Port using the socket API bind() function before read/writing data.
In Indy, TIdUDPBase has a Binding property of type TIdSocketHandle, which
has its own IP/Port properties and a Bind() method. You would have to call
Bind() before sending your data.
As for "Delphi Internet", how you bind a socket depends on the specific
component(s) that you are actually using.
Gambit