def write(self, msg): read, write, opt = select.select([ ], [ self.sock ], [ ], 5) if not len(write): my_print('Error: Cannot communicate with the server') self.socket.close() quit_client() os.write(self.sockfd, str(msg) + '\n')
def write(self, msg): read, write, opt = select.select([], [self.sock], [], 5) if not len(write): my_print('Error: Cannot communicate with the server') self.socket.close() quit_client() os.write(self.sockfd, str(msg) + '\n')
def read(self): read, write, opt = select.select([ self.sock ], [ ], [ ], 5) if not len(read): my_print('Error: Cannot communicate with the server') buf = os.read(self.sockfd, 4096) if len(buf) == 0: my_print('Error: Disconnected from server') self.close() quit_client() print 'server>', for line in buf.splitlines(): my_print(line)
def read(self): read, write, opt = select.select([self.sock], [], [], 5) if not len(read): my_print('Error: Cannot communicate with the server') buf = os.read(self.sockfd, 4096) if len(buf) == 0: my_print('Error: Disconnected from server') self.close() quit_client() print 'server>', for line in buf.splitlines(): my_print(line)