<s> """<STR_LIT>""" <EOL> import socket <EOL> port = <NUM_LIT> <EOL> line_length = <NUM_LIT> <EOL> def listen ( ) : <EOL> """<STR_LIT>""" <EOL> global listener <EOL> listener = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) <EOL> rcvbuf = listener . getsockopt ( socket . SOL_SOCKET , socket . SO_RCVBUF ) <EOL> listener . setsockopt ( socket . SOL_SOCKET , socket . SO_REUSEADDR , <NUM_LIT:1> ) <EOL> listener . bind ( ( '<STR_LIT:localhost>' , port ) ) <EOL> listener . listen ( <NUM_LIT:1> ) <EOL> print '<STR_LIT>' % ( port , rcvbuf ) <EOL> def connect ( ) : <EOL> global sender , receiver , msg , n , bufsize <EOL> sender = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) <EOL> sndbuf = sender . getsockopt ( socket . SOL_SOCKET , socket . SO_SNDBUF ) <EOL> print '<STR_LIT>' % ( sndbuf ) <EOL> sender . connect ( ( '<STR_LIT:localhost>' , port ) ) <EOL> print '<STR_LIT>' % port <EOL> receiver , addr = listener . accept ( ) <EOL> print '<STR_LIT>' , addr <EOL> msg = '<STR_LIT>' <EOL> n = <NUM_LIT:0> <EOL> bufsize = <NUM_LIT:0> <EOL> def close ( ) : <EOL> global sender , receiver <EOL> sender . close ( ) <EOL> receiver . close ( ) <EOL> def reset ( ) : <EOL> close ( ) <EOL> connect ( ) <EOL> listen ( ) <EOL> connect ( ) </s>
