开发者

Winsock 2.0 Will Not Connect to Public IP Address

So I am trying to build a simple text IM program to get into the wonderful world of networking. I have written 2 programs using Winsock 2.0 with C++: a server and a client. I have specified a UDP connection via the socket creation:

SOCKET Socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);

Everything works when I try to connect to the server using my local IP address. However, It will not connect when I 开发者_运维问答use my internet IP address. I am fairly certain that it is NOT a firewall issue, because I did multiple tests with both my firewall and antivirus disabled. Is there something I am missing? Can you think of any other reasons why it would be able to connect via the local address, but not the public IP address? Thank you very much!


Most likely the public IP address you have is owned by your network router appliance. It needs to be configured to pass traffic onto your computer

  public IP            internal router
   address +--------+  IP address  +---------+
      v    |        |  v           |         |
 ----------+ router +--------------+ desktop +
           |        |           ^  |         |
           +--------+   internal   +---------+
                      desktop IP address

http://portforward.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜