Ejemplo n.º 1
0
 def send_cmd(self, cmd):
     if len(cmd) > 0:
         self.cmd_history.append(cmd)
         self.history_idx = 0
         msg = dsock.comm_encode('CMD', cmd)
         self.sock.enque(msg)
         self.sock.send()
     else:
         self.sock.enque(dsock.comm_encode('IDLE', ''))
         self.sock.send()
Ejemplo n.º 2
0
 def login(self, evt):
     global the_error_frame
     uname = self.login_field.GetValue()
     paswd = self.password_field.GetValue()
     the_socket = dsock.LineSocket(dconfig.get('HOST'),
                                   dconfig.get('PORT'),
                                   dconfig.get('TIMEOUT'))
     the_socket.enque(dsock.comm_encode("LOGIN", uname))
     the_socket.enque(dsock.comm_encode("PASSWORD", paswd))
     the_socket.enque(dsock.comm_encode("VERSION", str(CLIENT_VERSION)))
     the_socket.send()
     typ, dat = the_socket.suck_read(wait=dconfig.get('TIMEOUT'), interval=0.2)
     if typ == "WELCOME":
         self.spawn_main_window(the_socket)
     elif typ == "TEXT":
         the_error_frame = ErrorWindow(dat, 'Error')
         self.Close()
     else:
         the_error_frame = ErrorWindow(
             "The server failed to respond appropriately.\n")
         self.Close()
Ejemplo n.º 3
0
 def ping_back(self, timestamp):
     self.debug_msg('* pinging back {} *'.format(timestamp))
     msg = dsock.comm_encode('PING', timestamp)
     self.sock.enque(msg)
     self.sock.send()