java - Connection refused on remote IP, but accepted on local IP (Solved) -


as title says, have server running on local machine, tested , debugged , worked (server written in java well). when tried test remote ip (instead of 192.168.0.113 used 146.255.x.x), , server didnt receive anything, while client has thrown this:

09-04 18:23:27.595: w/system.err(24241): java.net.connectexception: failed connect /146.255.x.x (port 4040): connect failed: econnrefused (connection refused) 09-04 18:23:27.595: w/system.err(24241):    @ libcore.io.iobridge.connect(iobridge.java:114) 09-04 18:23:27.595: w/system.err(24241):    @ java.net.plainsocketimpl.connect(plainsocketimpl.java:192) 09-04 18:23:27.595: w/system.err(24241):    @ java.net.plainsocketimpl.connect(plainsocketimpl.java:172) 09-04 18:23:27.595: w/system.err(24241):    @ java.net.socket.startupsocket(socket.java:566) 09-04 18:23:27.595: w/system.err(24241):    @ java.net.socket.tryalladdresses(socket.java:127) 09-04 18:23:27.595: w/system.err(24241):    @ java.net.socket.<init>(socket.java:177) 09-04 18:23:27.595: w/system.err(24241):    @ java.net.socket.<init>(socket.java:149) 09-04 18:23:27.595: w/system.err(24241):    @ com.statenislandchat.main$2$1$1.run(main.java:146) 09-04 18:23:27.595: w/system.err(24241): caused by: libcore.io.errnoexception: connect failed: econnrefused (connection refused) 09-04 18:23:27.595: w/system.err(24241):    @ libcore.io.posix.connect(native method) 09-04 18:23:27.600: w/system.err(24241):    @ libcore.io.blockguardos.connect(blockguardos.java:85) 09-04 18:23:27.600: w/system.err(24241):    @ libcore.io.iobridge.connecterrno(iobridge.java:127) 09-04 18:23:27.600: w/system.err(24241):    @ libcore.io.iobridge.connect(iobridge.java:112) 09-04 18:23:27.600: w/system.err(24241):    ... 7 more 

i disabled firewall on server pc long ago, , did forward ports on router. tried portscanners , detect service on port, client fails reach again , again.

solved! i'm not networking seems impossible connect if both server , client on same router. tried connecting distant client , worked.

econnrefused means connection attempted , remote host answered nobody's listening on port. mean several things:

  1. is ip? ifconfig/ipconfig (hint: not whatismyip.com say)?
  2. does java server listen on interfaces? same port on localhost open , closed on other interfaces. check bind addess on server.
  3. try telnet + tcpdump, show packets go correct address?

and these start.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

mysql - Pass value between different pages (form) with PHP -