I'm attempting to communicate with an existing server system that uses UDP to receive commands and return responses.
The server listens on a single port. It expects to reply back to the sending IP on the UDP source port the packet was sent from.
I can easily send it data using something like this:
sckServer.SendTo(bData, epServer)
where sckServer is a socket and epServer is an EndPoint containing the IP address and UDP port of the server.
I cannot find a way to set the sending (source) UDP port. It appears VB selects a random source port when sending. I don't know what this port will be, so I can't listen for the server reply.
Any ideas how to set the UDP source port on a socket send? Is there a better way to do this?
I can't change the server end of things, so I'm stuck making the client end work.
Any help would be greatly appreciated.
The server listens on a single port. It expects to reply back to the sending IP on the UDP source port the packet was sent from.
I can easily send it data using something like this:
sckServer.SendTo(bData, epServer)
where sckServer is a socket and epServer is an EndPoint containing the IP address and UDP port of the server.
I cannot find a way to set the sending (source) UDP port. It appears VB selects a random source port when sending. I don't know what this port will be, so I can't listen for the server reply.
Any ideas how to set the UDP source port on a socket send? Is there a better way to do this?
I can't change the server end of things, so I'm stuck making the client end work.
Any help would be greatly appreciated.