in reply to Unix socket domain datagram within local server

From the documentation of recv:

Returns the address of the sender if SOCKET's protocol supports this; returns an empty string otherwise. If there's an error, returns the undefined value.

This means the while loop will terminate when the call happens to return a false value. This works for me:

while (1) { defined $sock->recv($data, 1024) or die "recv error: $!"; ...

Update 2019-08-17: Updated the link to "Truth and Falsehood".

Replies are listed 'Best First'.
Re^2: Unix socket domain datagram within local server
by evergreen (Novice) on Dec 22, 2018 at 19:48 UTC
    Thanks, that fixed it.