in reply to Re^4: IO Socket - Detect inbound IP
in thread IO Socket - Detect inbound IP

$sock isn't connected to anything. That's why you're getting

Use of uninitialized value in subroutine entry Bad arg length for Socket::inet_ntoa, length is 0, should be 4

$! contains the following, but you might not have known that peeraddr sets it on error.

Transport endpoint is not connected

You want to know to whom $new_sock is connected.