Fixed potential deadlocks in server/client
Fixed deadlocks in server that cause clients to be unable to connect
Fixed deadlocks in client that cause the application to freeze
Updated message receiving methods to avoid blocking calls