UDP Address already in use?

后端 未结 3 840
时光取名叫无心
时光取名叫无心 2021-01-13 14:04

I am following the UDP tutorials at http://docs.oracle.com/javase/tutorial/networking/datagrams/broadcasting.html ,I have copied all the code and compiled it, now If I compi

相关标签:
3条回答
  • 2021-01-13 14:36

    You can do the following:

    Use netstat coomand to view which application is using that port. Then use tasklist and taskkill to kill the application at that port.

    0 讨论(0)
  • 2021-01-13 14:45

    Possibly what happens is that you have on the client side two wires that connect to the same port. When you receive a message from the server, the client machine does not know what thread to redirect the message since they have two different DatagramSocket tips pointing to the same port

    0 讨论(0)
  • 2021-01-13 14:51

    This is likely because you are already running an instance of the server. Only one server can listen on a given port at a time. Check to see if you are already running an instance (if you are using Eclipse, you should see this in the command window) and terminate it before running another instance.

    Though it is also possible that a stream was not shut down properly. If you are running an IDE, restarting the IDE should fix the problem, though occasionally I have had to restart my computer. Probably a better solution to fix this, but that is what has worked for me.

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