java中socket的连接问题
我试过这个代码: http://programming-guides.com/java/tcp-client-server-chat (完整的例子)
它正在工作,但是当我将客户端的“主机”切换到外部IP(本地主机)时,它给了我这个错误: “无法获取 IO 连接到..”
我试图切换端口,但它不起作用..
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..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试 netcat 到远程主机。如果您获得连接,则该示例可能是错误的。如果没有,您将无法连接到该主机:主机不存在、未侦听该端口、端口被过滤等等。
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.
服务器是否在那台远程计算机上运行?防火墙中的端口是否开放?
Is the server running on that remote machine? Is the port open in the firewall?