Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- ### SERVIDOR ###
- mi_socket = socket.socket()
- mi_socket.bind(('localhost','8000'))
- mi_socket.listen(5)
- while True:
- conexion, addr = mi_socket.accept()
- print("Nueva Conexion Establecida: ", addr)
- conexion.send("Conexion establecida con el servidor")
- conexion.close()
- ### CLIENTE ###
- mi_socket = socket.socket()
- mi_socket.connect(('localhost',8000))
- mi_socket.send("Hola desde el cliente")
- respuesta = mi_socket.recv(1024)
- print(respuesta)
- mi_socket.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement