Skip to content

Instantly share code, notes, and snippets.

@aledruetta
Created March 27, 2021 12:56
Show Gist options
  • Save aledruetta/0f56f5cbc654ada028a5a2bad5c9eccd to your computer and use it in GitHub Desktop.
Save aledruetta/0f56f5cbc654ada028a5a2bad5c9eccd to your computer and use it in GitHub Desktop.
# cliente.py
from socket import *
HOST = "192.168.1.2"
PORT = 5001
def upper_rcp(msg):
s = socket(AF_INET, SOCK_STREAM)
s.connect((HOST, PORT))
s.send(msg.encode())
data = s.recv(1024)
s.close()
return data.decode()
if __name__ == "__main__":
msg = input("say> ")
resp = upper_rcp(msg)
print(f"echo> {resp}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment