Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Jan : Re: Help with socket ports on TUDPSocket

www.cryer.info
Managed Newsgroup Archive

Re: Help with socket ports on TUDPSocket

Subject:Re: Help with socket ports on TUDPSocket
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Fri, 11 Jan 2008 09:45:18

"PC Pete" <PCPete@audiography.com.au> wrote in message
news:4786e4c6@newsgroups.borland.com...

> But although I explicitly set remote IP and port, and local
> port numbers, when I call SendBuf, each packets' sourceport
> is not the local port I specified.

That is because TUDPSocket never calls the TIpSocket.Bind() method to
establish the local IP/Port for the allocated socket.  Without that, the
socket's local port remains 0, telling the OS to pick a random port instead.
Without re-writting TUDPSocket, one thing you can do is use the
OnCreateHandle event to bind the socket manually.  Otherwise, I suggest you
switch to a different component, such as the UDP client in Indy, ICS, or
Synapse.

> The same code sequence in the "old" application is identical, and
> the packet that goes on the wire contains the correct source and
> destination ports.

You are comparing apples and oranges.  Just because one vendor's component
has certain functionality does not mean that another vendor's component will
have the same functionality.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive