0

I have a Thread currently listening to a port.

When some other threads sends signal I want to make it listen to other port (close current socket and open other socket on a different port).

How can I do this without interrupting the Thread and creating a new one? Did some search and did not found any way of signaling a Thread that is doing some other task.

Sri
  • 437
  • 1
  • 4
  • 13
ladca
  • 25
  • 5
  • 2
    If the thread is blocking indefinetly (e.g. because it is listening on a port without a timeout), we cannot "interrupt" the thread. – Turing85 Apr 02 '21 at 14:13
  • maybe this will help: https://stackoverflow.com/questions/2983835/how-can-i-interrupt-a-serversocket-accept-method – Lazar Petrovic Apr 15 '21 at 09:28

0 Answers0