import socket as S
HOST = "0.0.0.0"
PORT = 10
def server():
server = S.socket(S.AF_INET, S.SOCK_STREAM)
server.bind((HOST, PORT))
server.listen()
running = True
while running:
client, adress = server.accept()
print("connecte avec", str(adress))
client.send("hello".encode("utf-8"))
def client():
cli = S.socket(S.AF_INET, S.SOCK_STREAM)
while True:
print("connect")
cli.connect((HOST, PORT))
cli.send("yo je suis client".encode("utf-8"))
sleep(1)
if __name__ == "__main__":
server()
# client(), for client
Hi, using Socket, i want to make a connection between two machine by the simlpest way possible. I made the python script above, my problem is that nothing happend. Is it a python issue ? machine issue ? how should i make this ?
Thanks.