Ping, Logging and socket cleanup

Added a 5second Ping to check for connected clients, added a logging
textbox, and fixed some of the socket logic to not fail. Failsafe is to
use background threads now too.