Original Post
Im having problem with this java socket. I have written fairly simple program that simply waits for an incomming connection. when It gets an accept it creates a outputstream and sends a small message. this program works while im connecting to the local port (ither 127.0 or 192.168 adress, im currently behind a firewall but the port im connectiong to is forwared to this computer) and I get the message sent back to me. It works also if im on a computer outside of this network and connect. what doesnt work is when I try to connect to the program through the external port from inside the network. when I try I get this message: "Connection accepted from " "Connection reset by peer: socket write error" The connection seems to get accepted.. but then just doesnt work. Its also kind of wierd that instead of getting an external ip, I get the internal ip. Have anyone else had this problem? do anyone know what could be done about it? If you could help i would really apriciate it ^_^; here is the simple code. import java.io.*; try{ ServerSocket serversocket = null; Socket socket = null; serversocket = new ServerSocket(5333); socket = serversocket.accept(); System.out.println("Server:Connection accepted from: " + socket.getInetAddress()); OutputStream ut = socket.getOutputStream(); String hej = "Message!"; ut.write(hej.getBytes()); ut.flush(); }catch(Exception e){ System.out.println("Error?:" + e.getMessage()); }