Advertisement
Astranome

SocketClient

Jul 2nd, 2020
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. import socket, time
  2.  
  3. s = socket.socket()
  4. host = '127.0.0.1' # needs to be in quote
  5. port = 1247
  6. s.connect((host, port))
  7.  
  8. print (s.recv(1024).decode)
  9. a=1
  10. while True:
  11.  
  12.     a=a+2
  13.     b=str(a)
  14.     s.send(b.encode())
  15.     #inpt = input('type anything and click enter... ')
  16.  
  17.     #s.send(inpt.encode())
  18.     print ("the message has been sent")
  19.     time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement