Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- sock = socket.socket()
- sock.bind(('10.8.128.183',9991))
- sock.listen(3)
- A, addrA = sock.accept()
- B, addrB = sock.accept()
- A.send(b"x")
- B.send(b"0")
- #A.send(b"Hello!")
- #B.send(b"Hello!")
- cnt = -1
- while True:
- cnt = (cnt + 1) % 2
- to = A#ходит B
- from_who = B
- if cnt == 0:#ходит A
- to = B
- from_who = A
- #x=0
- #to.send(b"Write smth")
- data = from_who.recv(1024)
- if not data:
- break
- elif data == b"end":
- A.send(b"end")
- break
- #print(b"from CLIENT ")
- #print(data)
- #print()
- #message = bytes(input(), 'utf-8')
- to.send(data)
- #str = bytes(s, 'utf-8')
- A.close()
- B.colse()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement