ServerSocket behind router

Hi all,

I am trying to build a simple client-server game every thing is ok when I test my program on my computer (when client connects to localhost) but when I tried to make someone connects to me it fails and I doesn't recieve any connections.

My computer is behind a router which takes a dynamic IP from my ISP but I configured the router to send incoming traffic on port I used to my computer and it works very well with port 80 (internet users can see a website on my computer) and with other ports(I tested this and I'm able to connect to my computer even from a mobile) and I have no firewalls.

I am using code like this for server

MainProgram.socket=new ServerSocket(port);

MainProgram.connection=MainProgram.socket.accept();

MainProgram.output=new ObjectOutputStream(MainProgram.connection.getOutputStream());

MainProgram.output.flush();

MainProgram.input=new ObjectInputStream(MainProgram.connection.getInputStream());

and code like this for client

MainProgram.connection=new Socket(InetAddress.getByName(ip),port);

MainProgram.output=new ObjectOutputStream(MainProgram.connection.getOutputStream());

MainProgram.output.flush();

MainProgram.input=new ObjectInputStream(MainProgram.connection.getInputStream());

any one can help?

[1528 byte] By [minashokrya] at [2007-11-26 12:31:57]
# 1
fails how?
ejpa at 2007-7-7 15:44:18 > top of Java-index,Core,Core APIs...
# 2
I mean by "fails" that I doesn't recieve any connections as no one connects and the client program hangs (it neither connects nor reports a connection refuse)
minashokrya at 2007-7-7 15:44:18 > top of Java-index,Core,Core APIs...