A simple UDP echo server implemented in Python

From , 5 Years ago, written in Python, viewed 182 times.
URL https://pastebin.vip/view/34d94cf9
  1. import socket, traceback
  2.  
  3. host = ''
  4. port = 51423
  5.  
  6. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  7. s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  8. s.bind((host, port))
  9.  
  10. while 1:
  11.     try:
  12.         message, address = s.recvfrom(8192)
  13.         print "Got data from", address
  14.         s.sendto(message, address)
  15.     except (KeyboardInterrupt, SystemExit):
  16.         raise
  17.     except:
  18.         traceback.print_exc()
  19.  
  20. #//python/8066

Reply to "A simple UDP echo server implemented in Python"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website