No response from break on external IP address in client-server IM app

I am following the tutorial @ http://www.geekpedia.com/tutorial239_Csharp-Chat-Part-1---Building-the-Chat-Client.html to try and put together the basics of networking. For those who don't want to jump into the leap, this is a quick way to demonstrate how to program a chat application for a client-server model.

When I try to run the code in tut, it works fine as long as the client and the server are on the same network, and the second I try to do it from the outside (getting the helper to start the client application, and starting the server application on my side) everything goes to the bank. The fact that the code is running on the same network leads me to believe that this is not a coding problem, but a problem with my network setup.

I'm trying to start a server at my IP address on port 21719 which I opened, but other people can't connect to my server without being able to get some form of response.

Code (from tut) that the server uses to listen for connections:

public void StartListening()
        {


            IPAddress ipaLocal = ipAddress; //ipAddress is parsed from txtIP


            tlsClient = new TcpListener(ipaLocal, 21719);


            tlsClient.Start();


            ServRunning = true; //for the running loop

            // Start the new tread that hosts the listener
            thrListener = new Thread(KeepListening);
            thrListener.Start();
        }

      

Now the tutorial does indeed state that IPAddress ipaLocal = ipAddress;

There will be a problem with some of the configurations, and I'm starting to fear that my configuration might be included in it.

So, does anyone have a solution for me?

Thanks Sam

+2


source to share


3 answers


What is the local IP that you are using? (ipAddress) If it's 127.0.0.1 that's not correct (I don't know how this would work internally, but Windows seems to use magic from time to time). Also, if you have multiple network adapters on your local computer, perhaps port forwarding is configured on only one of them and you are using the IP of the other?

If that's not a problem, here are some general suggestions:



  • Take a copy of netcat. This is a small network test whose only job is to create a simple TCP connection. This will allow you to exclude your code as a variable in all of this. If netcat can form a connection, then you know your code is the problem. If not, you have verified that this is your router.

  • You can use WireShark (or TShark) to search for ICMP packets. Capturing ICMP packets on the machine remotely . If you get "Destination Unreachable" from your router, you have proven again that this is your router.

As Spencer said, you need to make sure port forwarding is configured on your router in order to forward all packets entering port 21719 to your internal machine. As for exactly how to do this, it's hard to tell without knowing what type of router.

+1


source


Do you have people using your external (internet) IP address? (See yours here .)
Have you bound your router to forward all messages from port 21719 to your server?



0


source


Some tips:

  • What operating system are you using? Review the scope and / or profiles (on the Advanced tab) of your firewall rule.
  • While your friend is trying to connect to the port (connect to im server), monitor traffic with Wireshark or Network Monitor (Wireshark has issues with Vista and Win 7). If you can't see anything that has ended up on your computer, the problem is probably on the router side. Double check your settings - you said you were setting a direct (NAT) rule, but did you also set that rule on your router's firewall?
0


source







All Articles