March 2019
Beginner
490 pages
12h 40m
English
To begin implementing the client, we will need to declare the IP address that we will be trying to send our UDP messages to, as well as the port number. This port number is arbitrary, but you must ensure you aren't using a socket that has already been taken:
UDP_IP_ADDRESS = "127.0.0.1"UDP_PORT = 6789message = "Hello, Server"
Now, it's time to create the socket through which we will be sending our UDP message to the server: clientSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM).
Once we've constructed our new socket, it's time to write the code that will send our UDP message: clientSocket.sendto(Message, (UDP_IP_ADDRESS, UDP_PORT)).
You can find the following code in the udp_client.py file inside the ...
Read now
Unlock full access