in reply to Reg socket

When you create or use a same socket more than once, use setsockopt function. Please note that, the socket address, port number will not be repeat. Further more reading see, perldoc -f setsockopt