我正在尝试用Java编写一个简单的客户端服务器程序: - 在同一台机器上运行服务器和客户端代码......但在运行时遇到错误: -
java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.(Unknown Source) at java.net.Socket.(Unknown Source) at Requester.run(Requester.java:13) at Requester.main(Requester.java:68) Exception in thread "main" java.lang.NullPointerException at Requester.run(Requester.java:45) at Requester.main(Requester.java:68)
任何人都可以帮忙!
答案 0 :(得分:0)
您尝试连接的端口是否已打开?是否存在可能阻止请求的活动防火墙?