Fixes issue #1: It was possible to send messages to a dead socket that was (maybe due to reace-conditions) still in the list of available sockets. Added a try-catch to fix this issue around every call of send()