简体   繁体   English

Java中套接字的连接问题

[英]Connection problem with sockets in java

i tried this code: http://programming-guides.com/java/tcp-client-server-chat (full example) 我尝试了以下代码: http : //programming-guides.com/java/tcp-client-server-chat (完整示例)

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.." 并且它正在工作,但是当我将客户端的“主机” int切换到外部IP(由localhost插入)时,它给了我这个错误:“无法获取IO进行连接。”

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. 尝试将Netcat连接到远程主机。 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. 如果不是,则无法连接到该主机:主机不存在,不在该端口上侦听,端口已被过滤等,等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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