简体   繁体   中英

Connection problem with sockets in java

i tried this code: http://programming-guides.com/java/tcp-client-server-chat (full example)

and it's working but when i switch the "host" int the client side to an external IP (insted of localhost) it give me this error: "Cannot get IO for connection to.."

i treid to switch the port but it didnt work..

Is the server running on that remote machine? Is the port open in the firewall?

Try to netcat to the remote host. If you get an connection the example maybe wrong. If not, you cannot connect to that host: host not exists, not listen on that port, port is filtered, etc, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM