Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import socket
  2. import threading
  3. import time
  4.  
  5. host = '10.90.78.40'
  6. port = 56983
  7.  
  8. aidhost = '10.90.78.41'
  9. aidport = 50009
  10. def listen():
  11. with socket.socket(socket.AF_INET,socket.SOCK_STREAM) as s:
  12. s.bind((host,port))
  13. s.listen(3)
  14. while True:
  15. conn, addr = s.accept()
  16. print("Connected by",addr)
  17. threading.Thread(target=reply_message, args=(conn,)).start()
  18.  
  19. def reply_message(conn):
  20. with conn:
  21. while True:
  22. data = conn.recv(1024)
  23. if data:
  24. conn.sendall(data)
  25. print(data.decode())
  26.  
  27. listen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement