You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
368 B

import socket
host = '192.168.50.106'
port = 2000
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((host, port))
while True:
data = input('Enter data to send: ')
s.send(data.encode('utf-8'))
if data == 'exit':
break
data = s.recv(1024)
print('Received data: ', data.decode('utf-8'))

Powered by INFORMATICA.FP.EDU.ES.