示例#1
0
 def _write_socket(self):
     """ Pass messages from queue to socket. """
     while True:
         now = time.time()
         if self._connected and (self._last_sync + SYNC_AFTER) < now:
             self._queue.put(request_packet(MSG_TIME))
             self._last_sync = now
         if not self._queue.empty():
             self._socket.send(self._queue.get())
 def _write_socket(self):
     """ Pass messages from queue to socket. """
     while True:
         now = time.time()
         if self._connected and (self._last_sync + SYNC_AFTER) < now:
             self._queue.put(request_packet(MSG_TIME))
             self._last_sync = now
         if not self._queue.empty():
             self._socket.send(self._queue.get())
示例#3
0
 def register(self):
     """ Transact with server. """
     self._queue.put(hello_packet(socket.gethostname(), mac(), __version__))
     self._queue.put(request_packet(MSG_SERVER_SETTINGS))
     self._queue.put(request_packet(MSG_SAMPLE_FORMAT))
     self._queue.put(request_packet(MSG_HEADER))
 def register(self):
     """ Transact with server. """
     self._queue.put(hello_packet(socket.gethostname(), mac(), __version__))
     self._queue.put(request_packet(MSG_SERVER_SETTINGS))
     self._queue.put(request_packet(MSG_SAMPLE_FORMAT))
     self._queue.put(request_packet(MSG_HEADER))