From bcd4801dfc6f057e2fbcd432bfe665b7304d0b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Gon=C3=A7alves=20Costa?= <20251144030032@ifrn.local> Date: Fri, 10 Apr 2026 21:35:09 -0300 Subject: [PATCH] =?UTF-8?q?Primeira=20aula=20de=20sockets=20com=20configur?= =?UTF-8?q?a=C3=A7=C3=A3o=20do=20cliente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sockets/cliente_tcp.py | 6 +++--- sockets/servidor_tcp.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sockets/cliente_tcp.py b/sockets/cliente_tcp.py index f7cdced..c38a583 100644 --- a/sockets/cliente_tcp.py +++ b/sockets/cliente_tcp.py @@ -5,11 +5,11 @@ from socket import * cliente = socket(AF_INET,SOCK_STREAM) #Abrir conexão -conexao = cliente.connect(("127.0.0.1",3000)) +conexao = cliente.connect(("10.209.1.45",3000)) #Enviar mensagem -cliente.send("Olá, servidor!".encode()) +cliente.send("Olá, servidor! Aqui é o Simon".encode()) # mensagem = cliente.recv(1024) -print(f"MEnsagem recebida {mensagem.decode()}") \ No newline at end of file +print(f"Mensagem recebida {mensagem.decode()}") \ No newline at end of file diff --git a/sockets/servidor_tcp.py b/sockets/servidor_tcp.py index 0ea734b..7226d22 100644 --- a/sockets/servidor_tcp.py +++ b/sockets/servidor_tcp.py @@ -7,6 +7,8 @@ servidor = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #Estabelecer vinculo com endereço e uma porta servidor.bind(("127.0.0.1",3000)) +print("Servidor inicializando...") + #Começa a ouvir tentativas de conexão servidor.listen()