feat: Semaine 9
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import socket
|
||||
from env_var import SERVER_PORT, CLIENT_PORT
|
||||
|
||||
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
# client.bind(("localhost", CLIENT_PORT))
|
||||
# client.connect(("localhost", SERVER_PORT))
|
||||
|
||||
client.sendto(
|
||||
"Salut depuis UDP".encode(),
|
||||
("localhost", SERVER_PORT)
|
||||
)
|
||||
|
||||
data, server_address = client.recvfrom(1024)
|
||||
print(f"Réponse du serveur : {data.decode()}")
|
||||
|
||||
client.close()
|
||||
Reference in New Issue
Block a user