Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import select
- import sys
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.connect(('localhost', 12345))
- while True:
- readable, _, _ = select.select([sock, sys.stdin], [], [])
- for s in readable:
- if s is sock:
- print(sock.recv(1024).decode())
- elif s is sys.stdin:
- sock.send(sys.stdin.readline().encode())
- sock.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement