All pastes #19501 Raw Edit

Untitled

public text v1 · immutable
#19501 ·published 2005-08-07 14:37 UTC
rendered paste body
import socket
mySocket = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
mySocket.bind ( ( '127.0.0.1', 8000 ) )
mySocket.listen ( 1 )
while True:
   channel, details = mySocket.accept()
   print 'We have opened a connection with', details
   print channel.recv ( 100 )
   channel.send ( 'SERVER' )
   channel.close()