0

I'm kind of a beginner at programming, so I don't know what I'm about to ask is even possible. I want to make a TCP/IP connection to a server over WAN.

Both Client and Server programs were made by me they work just fine in a LAN. I'm now trying over a WAN. I know the server IP Address and the Port he's listening from, but as a client I can't make the connection. I supposed it's because the Port is not actually open/available.

How can I make this to happen in the server side? Is there a way for me to start the server (maybe as administrator) and for it to open the Port by itself? Is this a router or Firewall issue?

If I wasn't clear enough, feel free to ask.

Cheers.

PS: Let me put it this way: If I make the connection in a LAN, it works. I set it to the local IP Address (192.168....) and choose whatever port I want and it works just fine. Once I put my public IP provided my ISP, it doesn't. I set the firewall router to accept everything and put a new rule in windows firewall to open port 100. What changed?

paulof91
  • 15
  • 8
  • Sounds more like a networking issue than a programming one... By WAN do you mean through the internet, or just a wireless router? – BradleyDotNET Oct 21 '15 at 16:59
  • 1
    In it's current form this question is not really suited for Stack Overflow. Most likely there is something blocking the specific TCP/IP port on the route from you client to your server. My guess is that the server is behind a NAT router and you need to configure the router to forward the specific port to your server but you have not specified any details about your setup so I my completely wrong. – Martin Liversage Oct 21 '15 at 16:59
  • What I made so far was a simple TCP connection provided by [link](http://csharp.net-informations.com). All I did was ask a friend to run the server program from his computer at his home. I set his public IP Address but failed to set the connection. – paulof91 Oct 21 '15 at 17:25
  • Answering my question, what changed was the port forwarding that is needed to make so my computer is able to read the ip packets. Do you know if it is possible to do the port forwarding through c#? – paulof91 Oct 21 '15 at 21:18

1 Answers1

1

Please check the following list,

  • Server Firewall rules to exclude the desired port
  • Router Firewall to exclude the desired port
  • Check any installed security software blocking your desired port
  • Last and crucial! Open router interface and configure your NAT settings so the packets running via the desired port are served to your local server IP
  • If everyhting is fine and your ISP is not blocking the desired port then you will have no problem.
  • You can also visit canyouseeme.org in order to check that server listening alright!

Kind Regards,
KB

Mr Konstantinos
  • 193
  • 1
  • 1
  • 11
  • Thanks, it worked. I had to do the port forwarding so I can receive the packets back to me. Do you know if it is possible to do the port forwarding through C#? – paulof91 Oct 21 '15 at 21:18
  • Yes it is possible if you use the class Open.NAT - More info can be found here https://github.com/lontivero/Open.NAT - Kind Regards – Mr Konstantinos Oct 21 '15 at 21:22
  • Lovely. I'll dig into it. Thank you for you help! – paulof91 Oct 21 '15 at 21:26