I'm working on a client/server and I'm having trouble getting them to communicate over the internet. If I'm running them on the same computer, it works fine if I have the client connect to localhost
or to my network address (192.16开发者_StackOverflow8.1...
), but it doesn't work (Error 10061: connection actively refused) if I have the client connect to my external address (99.141...
). I've tried turning my firewall off and I've forwarded the ports on the router, so I don't really know what else to check. The server is made with the TcpListener
class and the client is made with the TcpClient
class. The server is bound to IPAddress::Any
.
I checked netstat
and the server is broadcasting on the correct port, I just can't connect to it non-locally.
Have you turned on port forwarding on the external address, 99.141.x.x, for example, the client is connecting to port 901, it works on the private Class C network address such as 192.168.1.x, have you turned on the external address 99.141.x.x:901, so that it can send data in and out.... are you running the server behind the firewall at the external address 99.141.x.x:901?
Accordingly to the MSDN documentation for Winsock error, 10061 is Connection Refused...somewhere down the line, the client attempted to connect but got rejected...
It would help to run WireShark and investigate the packets if they are actually being transmitted...
More than likely the ISP has blocked incoming bound data packets....
精彩评论