Fix buffer overrun issue in ThreadedSocketConnection::send() method

Buffer overrun can happen in ThreadedSocketConnection::send() method when socket error occurres. The reason for this is due to using unsigned int to store sent bytes length.