<s> import socket <EOL> import numpy as np <EOL> import os . path as path <EOL> from tempfile import mkdtemp <EOL> from numpush . posix_io . sendfile import posix_sendfile <EOL> sock = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) <EOL> sock . connect ( ( "<STR_LIT:127.0.0.1>" , <NUM_LIT> ) ) <EOL> filename = path . join ( mkdtemp ( ) , '<STR_LIT>' ) <EOL> data = np . linspace ( <NUM_LIT:0> , <NUM_LIT:1000> ) <EOL> fd = open ( filename , '<STR_LIT>' ) <EOL> fp = np . memmap ( filename , dtype = data . dtype , shape = data . shape ) <EOL> fp [ : ] = data [ : ] <EOL> sent = posix_sendfile ( sock , fd , nbytes = <NUM_LIT> ) <EOL> assert sent == data . nbytes </s>
