Exemple #1
0
def load_client(client, cmd):
    """ Open socket and write command to be executed remotely
    """
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect(client)
    send_data(s, cmd)
    out = get_data(s)
    s.close()

    return out
Exemple #2
0
 def handle(self):
     """ Get input data with lenght + '\n' and process it
     """
     global TH_COUNT
     #print('Conected...')
     TH_COUNT += 1
     print('TH_COUNT in = ' + str(TH_COUNT))
     data = get_data(self.request)
     pool = Pool(len(data))
     out = pool.map(run_proc, data)
     pool.close()
     print(out)
     send_data(self.request, out)
     TH_COUNT -= 1
     print('TH_COUNT out = ' + str(TH_COUNT))