From Zenix, 8 Months ago, written in Python.
  1. import socket
  2.  
  3. sock = socket.socket()
  4. sock.bind(("0.0.0.0", 8080))
  5. sock.listen(22)
  6. try:
  7.   while 1:
  8.       c, addr = sock.accept()
  9.       print("new connection from --> %s" % addr[1])
  10. except KeyboardInterrupt:
  11.         #do something here that will clear *ALL* of the previous "print"
captcha