Brannon
Brannon

Reputation: 5424

set the source port on UDP Socket without using Bind?

Is there a way (in the .NET framework) to set the source port on a UDP packet without using the Socket.Bind call? This particular socket only sends data. I'm using the SendTo method that takes the remote address and port. I don't want to bind to anything. However, my client software uses the source port of the UDP packet for the return path.

Upvotes: 1

Views: 1687

Answers (1)

Celada
Celada

Reputation: 22261

Setting the source address and port is the whole purpose of the bind call. Why would you want to avoid calling it? What is it that you think that binding the socket does that you don't want to do?

No, there does not exist a second/alternate way to set the source address and port. Binding the socket is the one and only way to do that.

Upvotes: -1

Related Questions