Windows changes UDP destination port specified in send_to call??!!
I have an interesting bug i'm trying to understand. I am writing a simple
"UDP Socket" class that wraps the Winsock APIs. I have found that when i
specify a UDP server port on Windows (say 666) the port mysteriously gets
changed to another port (in this case 39426).
To clarify:
1) The UDP client sends a datagram from Windows box 1 to port 666 on Windows
box 2.
2) MS Network Monitor shows that the UDP client app is ACTUALLY using
destination port 39426 (the 666 has changed to 39426).
3) The UDP Server socket is undeed receiving datagrams from port 39426 since
the application receives the message.
I'm assuming that Windows for some reason changes the port behind my back!
Questions:
a) How is the client notified of the port change on the server side?
b) Why does Windows behave this way?
This behavior is a big problem for me since i need to communicate between
the Windows platform and an embedded platform using UDP datagrams. As it is
now, the embedded RTOS (Nucleus) is using the destination port used in the
Send_To call which results in the datagram being addressed to port 666
(which my PC-side UDP server doesn't receive on due to the port being
swapped behind my back).
Thanks,
/John.
|