Java Networking: Connection refused - Yes, my server is running

后端 未结 4 1052
你的背包
你的背包 2021-01-15 16:18

I\'m getting following error when my client tries to connect to my server socket:

java.net.ConnectException: Connection refused: connect

Bu

相关标签:
4条回答
  • 2021-01-15 16:46

    Some routers doesn't allow the internal network to connect to the external IP address of the router.

    You can try to use telnet to connect to your server socket. If telnet isn't able to establish a connection, it's likely a networking problem.

    0 讨论(0)
  • 2021-01-15 16:47

    Add the java.exe process and the port to your firewall exception list?

    edit: Just read you already tried that. All I can suggest is make sure the network is not blocking that port. (routers)

    0 讨论(0)
  • 2021-01-15 16:56

    Have You tried running it with JVM option: java.net.preferIPv4Stack=true ?

    0 讨论(0)
  • 2021-01-15 16:57

    For what I see in your code, you missed the part where you accept the conection, after instantiating the server socket you need ssocket.accept() to accept conections and then you have to start reading the outputstrem from the socket

    0 讨论(0)
提交回复
热议问题