Currently I'm experimenting with sockets and UDP packets.
I created a UDP soc开发者_运维知识库ket and binded it to 127.0.0.1, and when sending a UDP packet to 127.0.0.1, the server successfully received it.
But I want to be able to send UDP packets from external locations to my server and receive them. How would I do this?
That depends on your network topology and may be more of a question for http://serverfault.com.
Assuming your server is behind a NAT device, i.e. a router, you'd need to configure said device to forward a certain port to your server. Any packet reaching the NAT device on the public IP address on that port will be forwarded to the server as if it had been sent to the server directly.
精彩评论