开发者

Linux socket doesn't close

开发者 https://www.devze.com 2023-03-03 21:58 出处:网络
i have a problem. I run a TCP server in linux. I close the socket by close(socket) call. But when I try to rebind again, bind ca开发者_开发知识库ll fails with errno 98 => port is already binded. How s

i have a problem. I run a TCP server in linux. I close the socket by close(socket) call. But when I try to rebind again, bind ca开发者_开发知识库ll fails with errno 98 => port is already binded. How should i unbind that socket?


You have to set SO_REUSEADDR option on the socket, see here.


You can try setting the SO_REUSEADDR socket option, see this question for some discussion.

0

精彩评论

暂无评论...
验证码 换一张
取 消