fork download
  1. from __future__ import print_function
  2. import socket
  3. import time
  4.  
  5. def main():
  6. l = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  7. l.bind(('0.0.0.0', 2001))
  8. l.listen(100)
  9.  
  10. s, addr = l.accept()
  11. print('Accepted: sockname={} peername={}'.format(s.getsockname(), s.getpeername()))
  12.  
  13. while True:
  14. data = s.recv(1024)
  15. if len(data) == 0:
  16. break
  17. print('Received {} bytes'.format(len(data)))
  18.  
  19. print('Received EOF, not closing!')
  20.  
  21. time.sleep(1000)
  22.  
  23.  
  24. main()
  25.  
Time limit exceeded #stdin #stdout 5s 65704KB
stdin
Standard input is empty
stdout
Standard output is empty