Restart listener socket after error.

I found that sometimes the listener socket errors, and this prevents an further clients connecting.
This patch restarts the listener after an error so that new clients can connect.