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.

14 lines
361 B

import socket
HOST = '127.0.0.1'
PORT = 2000
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
print('Conectado con éxito')
s.send(b'Yo, tu cliente, te saludo.')
#numBytes = s.send(b'Yo, tu cliente, te saludo.')
#print (numBytes)
data = s.recv(1024) #línea bloqueante
print('Recibido:', repr(data))

Powered by Informatica FP.