开发者

Error 10061 while trying to connect to my own computer

开发者 https://www.devze.com 2023-01-09 10:47 出处:网络
I\'m just testing out some basic networking code written in Visual C++. I have a client app and a server app that don\'t do anyt开发者_运维问答hing fancy, since I\'m just testing - basically, the clie

I'm just testing out some basic networking code written in Visual C++. I have a client app and a server app that don't do anyt开发者_运维问答hing fancy, since I'm just testing - basically, the client sends ASCII-encoded strings to the server and the server sends it back all in caps.

Everything works fine when I run both programs on my computer, IF I set the client to connect to localhost or 127.0.0.1. However, if I use my network IP (192.168.1.whatever) I receive error 10061, that the host actively refused the connection.

I disabled my firewall and it didn't change the behavior, so I'm not sure exactly what's going on. I would think that if there's any sort of hardware firewall on the router, it shouldn't affect it since I'm staying local.


Ensure your server is not binding to a specific IP address; it should bind to IPAddress.Any on a specific port.

If that doesn't solve the problem, run the server and examine the output of netstat -a for your port.

0

精彩评论

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