Untitled

 avatar
user_7384651
plain_text
a month ago
335 B
2
Indexable
Never
import socket

MAXLINE = 1024

serv_sd = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
serv_sd.bind(('localhost', 5678))

while True:
    print("Server: waiting for client")
    data, cli_addr = serv_sd.recvfrom(MAXLINE)
    
    print("Recv:", data.decode())  # Display received string from the client

serv_sd.close()
Leave a Comment