Guest User

ss

a guest
Nov 15th, 2019
97
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import socket
  2.  
  3. HOST = '127.0.0.1'  
  4. PORT = 65432        
  5.  
  6. with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
  7.     s.bind((HOST, PORT))
  8.     s.listen()
  9.     conn, addr = s.accept()
  10.     with conn:
  11.         print('Connected by', addr)
  12.         while True:
  13.             data = conn.recv(1024)
  14.             if not data:
  15.                 break
  16.             conn.sendall(data)
RAW Paste Data