Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: IO::Socket persisting on Linux despite being closed

by superfrink (Curate)
on Oct 25, 2018 at 19:12 UTC ( [id://1224694]=note: print w/replies, xml ) Need Help??


in reply to IO::Socket persisting on Linux despite being closed (updated)

Linux keeps the socket in use while it is in the TIME_WAIT state. The SO_REUSEADDR option may help.

I haven't tried but does the following work?

$socket->setsockopt( SOL_SOCKET, SO_REUSEADDR, 1 );

Update: IO::Socket::INET references SO_REUSEADDR and SO_REUSEPORT. You may need to try each.

Replies are listed 'Best First'.
Re^2: IO::Socket persisting on Linux despite being closed
by Anonymous Monk on Oct 25, 2018 at 20:16 UTC
    SO_REUSEPORT is Linux-specific option to facilitate multi-threaded servers:
    SO_REUSEPORT (since Linux 3.9)
    Permits multiple AF_INET or AF_INET6 sockets to be bound to an identical socket address.
    For TCP sockets, this option allows accept(2) load distribution in a multi-threaded server to be improved by using a distinct listener socket for each thread. This provides improved load distribution as compared to traditional techniques such using a single accept(2)ing thread that distributes connections, or having multiple threads that compete to accept(2) from the same socket.
    Probably shouldn't be relevant here.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1224694]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 03:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found