Esempio n. 1
0
 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')
Esempio n. 2
0
 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')
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)