user1800007
user1800007

Reputation: 45

Tcp server works only locally

Nowadays Im working tcp classes of qt. I know network (or socket) programming has a huge world of its own, and I'm very poor in terms of knowledge in this area.

Im aware of the fact that by creating a simple client and a server I cant say I know network programming,as you will understand from the following question.

Anyway, I create simple client and server programs. And they work fine locally. But when I try to change the client so that it tries to connect to the ip that I see on whatismyip.com and deliver it to a friend of mine, he can not connect to the server running on my machine. Again, if I rebuild the client so that it tries to connect to the ip that I see on cmd>ipconfig , he can not connect.

What do you suggest? I use a mobile modem device on my notebook working from usb.

Upvotes: 0

Views: 1207

Answers (1)

JebaDaHut
JebaDaHut

Reputation: 541

The two main things you need to check / configure are:

A. Make sure you are listening on all IP addresses on your host computer

tcpListener = new TcpListener(IPAddress.Any, SERVER_PORT);

B. And this is important: Your mobile modem is most likely doing NAT translation and the firewall on it is also most likely blocking the incoming requests. Go into your modem settings and set it to port forward any connection requests on whatever port you use to your computer's internal IP address. Also, make sure you have your Windows firewall set to allow connections on your chosen port.

Upvotes: 3

Related Questions