sending and receiving udp packets on same port
i need my client app to be able to sendto() and recvfrom() through the same port using UDP.
I have discovered i can only bind one socket to the port and it's better to do it wh开发者_高级运维en using recvfrom(), otherwise things mess up.
I want to be able to still send UDP packets through that port but binding it to a different socket is a problem as i mentioned above.
What can i do ?
thanks.
This should work fine. One socket bound to a port where you use recvfrom() and sendto() on the same socket. See this example from MSDN that shows recvfrom() in isolation - right around the recvfrom() you should be able to sendto() using that same socket.
精彩评论