def _send_packet(self, data):
        " Send to server. "
        data = json.dumps(data).encode('utf-8')

        # Be sure that our socket is blocking, otherwise, the send() call could
        # raise `BlockingIOError` if the buffer is full.
        self.socket.setblocking(1)

        self.socket.send(data + b'\0')
Send to server.