Hi j-trobec,
I think you have misunderstood the problem
>The problem is that any time you want to send a message, you have to know what port you're sending it to...and that port >needs to be open. So, at the least, the server will need an open well known port.
There is a well known open port at the server where the server listens for connection requests and the client connects to the
server at that port. But if the server is behind firewall/NAT(i.e in a private LAN) and the client is in an outside n/w, the client
cannot make direct connection to the server because the firewall/NAT intercepts the packets sent from the server as also that
received from the client. The below diagram will explain it properly
--------------------------
\ /
----------- ------------- \ / ----------------
| Client1 | | Server | | | | Client2 |
----------- ------------- / \ ---------------
LAN / \
--------------------------
|
|
firewall/NAT
1. Consider the Server as the Chat Server
2. Client1 and Server are in the same private network.
3. The network is connected to the internet through firewall.
4. Client2 is not in the same network as Client1 and Server but is connected to the internet
5. In the above case Client1 can communicate with the Server without any hassle.
6. Client2 cannot connect to server unless the port forwarding is done for the Server at the firewall/NAT.
Now is there a way for communication to take place between Server and Client2 without manual port forwarding.
A related problem : Is there a way to determine if a client or server is behind NAT/firewall.
Main Topics
Browse All Topics





by: j-trobecPosted on 2005-06-10 at 08:21:31ID: 14189524
The problem is that any time you want to send a message, you have to know what port you're sending it to...and that port needs to be open. So, at the least, the server will need an open well known port. One thing you may try, so that the client doesn't need to open ports is use a model where the client just regularly polls the server for incoming messages. That way the client always innitiates the connection, and never needs to open a port and listen for incoming connections.