コード例 #1
0
 def test_server_client(self):
   self.start_server_thread()
   Pipe.wait_for('test_named_pipes', 1000)
   
   pipe = Pipe('test_named_pipes', server=False)
   pipe.write('clientToServer')
   self.assertEqual(pipe.read(), 'serverToClient')
   self.server_thread.join(5)
   self.assertFalse(self.server_thread.is_alive())
コード例 #2
0
ファイル: vdb.py プロジェクト: clucock1/vsi_common
def attach(pid):
  ''' Trigger a python pid that's been already run set_attach
  
      This is the second part of attaching to a python process. Once 
      set_attach is run, on another prompt running attach will trigger
      the interrupt thing attaching or triggering whatever db_cmd was'''
  if os.name == 'nt':
    pipe = Pipe('vdb_%d' % pid)
    pipe.write('vsi')
    pipe.close()
  else:
    os.kill(pid, ATTACH_SIGNAL)
コード例 #3
0
  def test_server_client_byte_read(self):
    self.start_server_thread()
    Pipe.wait_for('test_named_pipes', 1000)
    
    pipe = Pipe('test_named_pipes', server=False)
    pipe.write('clientToServer')
    str = ''

    while 1:
      byte = pipe.read(1)
      if byte is None:
        break
      self.assertEqual(len(byte), 1)
      str += byte
    self.assertEqual(str, 'serverToClient')
  
    self.server_thread.join(5)
    self.assertFalse(self.server_thread.is_alive())
コード例 #4
0
 def server(self):
   pipe = Pipe('test_named_pipes', server=True)
   self.assertEqual(pipe.read(), 'clientToServer')
   pipe.write('serverToClient')
   pipe.close()