Skip to content

Commit 6d0abd6

Browse files
authored
Create ClientTCP.py
0 parents  commit 6d0abd6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ClientTCP.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import socket
2+
3+
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
4+
client.settimeout(1)
5+
6+
try:
7+
client.connect(("127.0.0.1", 4466))
8+
client.send(b"MENSAGEM\n")
9+
pacotes_recebidos = client.recv(1024).decode()
10+
print(pacotes_recebidos)
11+
except Exception as error:
12+
print("Um erro ocorreu.")
13+
print(error)

0 commit comments

Comments
 (0)