Created
June 8, 2020 00:01
-
-
Save standarddeviant/f9c05e379c388b59ce2d1bfe8604bfdc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import sys | |
msgFromClient = "Hello UDP Server" | |
if len(sys.argv) >= 2: | |
msgFromClient = sys.argv[1] | |
bytesToSend = str.encode(msgFromClient) | |
serverAddressPort = ("192.168.0.174", 3333) | |
bufferSize = 1024 | |
# Create a UDP socket at client side | |
UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) | |
# Send to server using created UDP socket | |
UDPClientSocket.sendto(bytesToSend, serverAddressPort) | |
# msgFromServer = UDPClientSocket.recvfrom(bufferSize) | |
# msg = "Message from Server {}".format(msgFromServer[0]) | |
# print(msg) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment