Error 10061 while trying to connect to my own computer
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.
精彩评论