Socket and portforwarding problem

Started by
1 comment, last by Furie 18 years, 8 months ago
Ive created a small server program (written in java) that just takes an incomming connection on a port and just sends a message on that connection. The program is on a computer on a network that has a firewal that distributes ip. The firewal has been set to "port forward" any connection to that computer. The program works fine when I connect to it localy (ither 127.0.0.1 or an 192.168 adress). It even works fine when I connect to it from outside the network. What doesnt work tho is when I try to connect from inside the network to the external ip. Wierd thing is.. the connection gets accepted, on the local 192.168 adress rather then the external adress as I would have expected. Even tho the connection is accepted, I cant use it. The server just gives me the message "Connection reset by peer". anyone else have this problem? know any way to solve it? Any help would really be apriciated ^_^;
Advertisement
Quote:What doesnt work tho is when I try to connect from inside the network to the external ip.


Your firewall is causing this. It could potentially do two-way NAT from nodes within the network, but apparently it doesn't. Call the vendor and ask for a fix ;-)

The only other alternative is to find out the internal address on the client, and connect to that instead. You could, for example, use something like Rendez-vous, or something else based on UDP broadcast, to find the service you want on the local subnet; if you can't find it that way, connect to the known IP address (presumably found using DNS).

Or, if this is for testing only, just allow the address to be specified on the command line.
enum Bool { True, False, FileNotFound };
Hmmm. Ill look in to that.
thanx for the info man

This topic is closed to new replies.

Advertisement