Java network server and TIME_WAIT

后端 未结 3 1612
你的背包
你的背包 2021-01-15 20:17

I have run into a problem with a network server that receives signals from devices my company produces. The device will occasionally reuse the source port that it had just

3条回答
  •  [愿得一人]
    2021-01-15 21:00

    Building on Nikolai's answer,

    Socket s;
    ...
    s.setSoLinger(true,0);
    

    would be the equivalent in Java.

    EDIT: Another thing you might like to look at would be setReuseAddress(true);

提交回复
热议问题