Ejemplo n.º 1
0
def run_interaction (run_client):
    s, port = init_server()
    start_new_thread(handle_request, (s, run_client))
    if run_client:
        start_new_thread(make_request, (port,))
    sleep(0.1 + SOCKET_TIMEOUT)
    #print sys.getrefcount(s.fd)
    #s.close()
    return weakref.ref(s.fd)
Ejemplo n.º 2
0
 def clientSetUp(self):
     # The is a hittable race between serverExplicitReady() and the
     # accept() call; sleep a little while to avoid it, otherwise
     # we could get an exception
     time.sleep(0.1)
     self.cli = socket.socket(socket.AF_TIPC, socket.SOCK_STREAM)
     addr = (socket.TIPC_ADDR_NAME, TIPC_STYPE,
             TIPC_LOWER + (TIPC_UPPER - TIPC_LOWER) / 2, 0)
     self.cli.connect(addr)
     self.cliaddr = self.cli.getsockname()
Ejemplo n.º 3
0
 def clientSetUp (self):
     # The is a hittable race between serverExplicitReady() and the
     # accept() call; sleep a little while to avoid it, otherwise
     # we could get an exception
     time.sleep(0.1)
     self.cli = socket.socket(socket.AF_TIPC, socket.SOCK_STREAM)
     addr = (socket.TIPC_ADDR_NAME, TIPC_STYPE,
             TIPC_LOWER + (TIPC_UPPER - TIPC_LOWER) / 2, 0)
     self.cli.connect(addr)
     self.cliaddr = self.cli.getsockname()
Ejemplo n.º 4
0
 def testInsideTimeout(self):
     conn, addr = self.serv.accept()
     self.addCleanup(conn.close)
     time.sleep(3)
     conn.send("done!")
Ejemplo n.º 5
0
 def _testRecv(self):
     self.cli.connect((HOST, self.port))
     time.sleep(0.1)
     self.cli.send(MSG)
Ejemplo n.º 6
0
 def _testAccept(self):
     time.sleep(0.1)
     self.cli.connect((HOST, self.port))
Ejemplo n.º 7
0
 def _testClose(self):
     self.cli.connect((HOST, self.port))
     time.sleep(1.0)
Ejemplo n.º 8
0
 def testInsideTimeout (self):
     conn, addr = self.serv.accept()
     self.addCleanup(conn.close)
     time.sleep(3)
     conn.send("done!")
Ejemplo n.º 9
0
 def _testRecv (self):
     self.cli.connect((HOST, self.port))
     time.sleep(0.1)
     self.cli.send(MSG)
Ejemplo n.º 10
0
 def _testAccept (self):
     time.sleep(0.1)
     self.cli.connect((HOST, self.port))
Ejemplo n.º 11
0
 def _testClose (self):
     self.cli.connect((HOST, self.port))
     time.sleep(1.0)