Пример #1
0
def main(argv):
    socket = pyudt.UdtSocket()
    socket.connect(('127.0.0.1', 4032))

    import time
    time.sleep(190)
    socket.send('words')
Пример #2
0
def main(argv):
    serv = pyudt.UdtSocket()
    serv.bind(('127.0.0.1', 4032))
    serv.listen(100)

    c0, c0_host = serv.accept()
    print(c0_host)

    try:
        print c0.recv(len('words'))
    except udt.UDTException as err:
        print(err)
    #c1, c1_host = serv.accept()
    #print(c1_host)

    print('continue on')
Пример #3
0
def udt_main(argv):
    sock = pyudt.UdtSocket()
    sock.connect((sys.argv[1], int(sys.argv[3])))

    for x in range(3):
        message = 'you ' * 30

        sock.send(struct.pack('i', version))
        sock.send(struct.pack('l', len(message)))
        sock.send(message)

        time.sleep(x)

    time.sleep(5)

    sock.close()
Пример #4
0
def main(argv):
    socket = pyudt.UdtSocket() 
    print('connect( (%s, %i) )' %(argv[1], int(argv[2])))
    socket.connect( (argv[1], int(argv[2])) )
    
    print('connected')
    udt.dump_perfmon(socket.perfmon())  
    
    h0 = Handler(lambda: recv0(socket))
    h0.start() 
    h1 = Handler(lambda: send1(socket)) 
    h1.start() 

    h0.join()
    h1.join() 
    

    udt.dump_perfmon(socket.perfmon())  
    socket.close() 
Пример #5
0
def acquire_udt_clients(serv_addr, serv_port, count):
    print('Acquiring UDT clients')
    udt_serv = pyudt.UdtSocket()
    udt_serv.bind((serv_addr, serv_port))
    udt_serv.listen(100)

    clients = []

    for i in xrange(count):
        Popen('./client.py %(host)s %(protocol)s %(port)i ' % {
            'host': serv_addr,
            'port': serv_port,
            'protocol': 'udt'
        },
              shell=True)

        socket, client_addr = udt_serv.accept()
        clients.append(socket)

    return udt_serv, clients
Пример #6
0
def acquire_udt_children(host, port, count):
    print('acquiring udt clients')
    udt_serv = pyudt.UdtSocket()
    udt_serv.bind((host, port))
    udt_serv.listen(100)

    children = list()

    for i in xrange(count):
        Popen('./client.py %(host)s %(protocol)s %(port)i ' % {
            'host': host,
            'port': port,
            'protocol': 'udt'
        },
              shell=True)

        socket, host = udt_serv.accept()

        children.append(socket)

    return children
Пример #7
0
def main(argv):
    Popen('./client.py %(host)s %(port)i' % {
        'host': '127.0.0.1',
        'port': 3001
    },
          shell=True)

    server = pyudt.UdtSocket()
    server.bind(('127.0.0.1', 3001))
    server.listen(100)

    client, host = server.accept()
    print('accepted:')

    for i in range(100):
        client.recv(1024)

    for i in range(100):
        client.send('a' * 1024)

    client.close()
    server.close()
Пример #8
0
def main(argv):
    Popen('./client.py %(host)s %(port)i' % {
        'host': '127.0.0.1',
        'port': 3001
    },
          shell=True)

    server = pyudt.UdtSocket()
    server.bind(('127.0.0.1', 3001))
    server.listen(100)

    client, host = server.accept()

    h0 = Handler(lambda: send0(client))
    h0.start()
    h1 = Handler(lambda: recv1(client))
    h1.start()

    h0.join()
    h1.join()

    client.close()
    server.close()
Пример #9
0
def main(argv):
    socket = pyudt.UdtSocket() 
    print('connect( (%s, %i) )' %(argv[1], int(argv[2])))
    
    pre_opt_test(socket)

    socket.connect( (argv[1], int(argv[2])) )
    print('connected...')
    post_opt_test(socket) 
    
    socket.perfmon() 

    for i in range(100):
        socket.send('a' * 1024) 
        sys.stderr.write('.') 
    
    for i in range(100):
        socket.recv(1024) 
        sys.stderr.write('.') 

     
    udt.dump_perfmon(socket.perfmon())     

    socket.close() 
Пример #10
0
#!/usr/bin/python

from udt4 import pyudt

s = pyudt.UdtSocket()
s.fileno()
Пример #11
0
def main(argv):
    socket = pyudt.UdtSocket()
    socket.connect(('127.0.0.1', 4032))