Added error checking to the socket_listen part of pd