Added error handling for bad connection on client, and socket being used already on server