Erkil1452
Erkil1452

Reputation: 21

Linux socket doesn't close

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 call fails with errno 98 => port is already binded. How should i unbind that socket?

Upvotes: 2

Views: 1368

Answers (2)

Code Painters
Code Painters

Reputation: 7275

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

Upvotes: 3

unwind
unwind

Reputation: 399793

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

Upvotes: 0

Related Questions