[RESOLVED] TCPClient Chat Application and Router Configuration
Hi,
I'm new here so sorry if I have posted this in the wrong area! I've been stumped by this issue for a while so thanks to any who can make it a bit more clear for me :)
I have been reading the thread on IP forwarding here and I have just one further query ...
I am writing a chat server kind of app, and have followed the MSDN examples. (Using TCP sockets in .NET) These explain pretty well how to get the application running on a LAN, and at the moment mine does this. But I cannot get the app to connect to a server across the internet (especially one in a small network hidden behind a firewall / router).
Is there a particular port that I should be using, and does every user of the application have to set their router up for port forwarding (this seems like a fairly high maintenance requirement for a simple chat application).
Thanks!
1 Attachment(s)
Re: TCPClient Chat Application and Router Configuration
to run it on the internet you need port forwarding yes. I assume one of your LAN terminals will run the Server app and the client can connct either from the LAN or from anywhere on the internet... All you need to do is on the router, forward the port which the server app listens on to the LAN IP of the terminal with the server app running
sorry if i dont make it clear enough!
See pic for a rough diagram i just came up with...
Re: TCPClient Chat Application and Router Configuration
so in the above diagram the chat app server is running on a LAN terminal behind the router (which is the internet gateway). In that example, any client on the network can connect directly to port 8989 on PC2. Say if a remote internet user tries to connect, they need to connect to the Ineternet IP of the Router (on port 8989) the router will then pass the connection attempt on to PC2 (192.168.1.4) which can accept the connection and user your chat system
note: it can be any port, as long as it is not already in use by another software. But to avoid confliction dont use anything much lower then the 10,000 mark. There is approx 65,000 ports available
Re: TCPClient Chat Application and Router Configuration
Thanks for your answers, Chris.
So that means if the clients are behind a router they would also have to set up their router for port forwarding?
This just seems like a lot to do for the average user trying to get the program to run on their home PC...
Re: TCPClient Chat Application and Router Configuration
no, you dont have to set up forwarding for the clients behind your router. You only have to set it up for one port on the router - that is for internet clients. Say if you were just going to use your chat app only on your network, you would not need to set up forwarding at all.
you only need to add one rule to the forwarding, simply forward the port your app uses to the IP address of the terminal which is the server :thumb:
Re: TCPClient Chat Application and Router Configuration
Sorry, perhaps I should have been more clear...
If the clients were behind a DIFFERENT router (i.e. my friend at his house, behind the router there) would his router have to set up port forwarding for his client as well?
Re: TCPClient Chat Application and Router Configuration
Quote:
Originally Posted by Mecharius
Sorry, perhaps I should have been more clear...
If the clients were behind a DIFFERENT router (i.e. my friend at his house, behind the router there) would his router have to set up port forwarding for his client as well?
in short....No. :)
the only router which needs port forwarding is the router which is in front of the server computer.
if the server app connects to the inernet through a router, thats the only router which needs port forwarding
this is assuming you have one computer running the server app, then several other computers running the client
Re: TCPClient Chat Application and Router Configuration
Yes, thats it. Thanks heaps for your help!