I have an ADSL router, and hub switch before my comuter
Router IP is: 192.168.1.1
My local IP is: 192.168.1.7
I set the vitual server setting of the ADSL router as the following:
MyConnetion switchs to local IP 192.168.1.7 and both of their ports are 1099
I start my RMI server like this
start rmiregistry
start java ServerObj
my server code: Naming.rebind("rmi://192.168.1.7/MMM", XX);
any other local computers (eg: 192.168.1.8, 192.168.1.6) can invoke the rmi methods and work fine
but my friend fails to invoke my RMI methods through the Internet
client file: Jitf XX = (Jitf)Naming.lookup("rmi://"+args[0].trim()+"/MMM");
I gave my friend my IP address eg 203.168.57.203 as Client file's main method's input argument
Then, it just fails
Error Msg
java.rmi.ConnectException: Connection refused to host: 192.168.1.7; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
at J701Impl_Stub.returnInt(Unknown Source)
at J701cli.main(J701cli.java:13)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
at java.net.Socket.connect(Socket.java:425)
at java.net.Socket.connect(Socket.java:375)
at java.net.Socket.<init>(Socket.java:290)
at java.net.Socket.<init>(Socket.java:118)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:122)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
... 5 more
Coudl anyone know how to solve this problem, please?
When I used Dail-up 56k connection, my computer owns the IP from ISP.
And I start my RMI servcer directly with the IP from ISP
ie. Naming.rebind("rmi://Whatever IP ISP gives me/MMM", XX);
So all worked fine (both local and Internet invocations)
But not now.............
Could any help me, please?