Exemplo n.º 1
0
        nsent = dest.send(view)
        view = view[nsent:]

def recv_into( arr, source):
    view = memoryview(arr).cast('B')
    while len(view):
        nrecv = source.recv_into(view)
        view = view[nrecv:]

#server

from socket import *
s = socket(AF_INET, SOCK_STREAM)
s.bind( ('', 25000))
s.listen(1)
c, a = s.accept()

#after client connected
import numpy
a = numpy.arange(0.0, 50000000.0)
send_from(a, c)


#client 

from socket import *
c = socket(AF_INET, SOCK_STREAM)
c.connect( ('localhost', 25000))

import numpy
a = numpy.zeros( shape = 50000000, dtype = float)