We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1df584 commit 5dd2cbdCopy full SHA for 5dd2cbd
udp-client.py
@@ -0,0 +1,19 @@
1
+import socket
2
+
3
+# can't find a udp server so using local settings
4
5
+target_host = "127.0.0.1"
6
+target_port = 9997
7
8
+# create a socket object with datagram settings
9
+client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
10
11
+# send data to the target host, port
12
+client.sendto(b"AAAABBBBCCCC", (target_host, target_port))
13
14
+# receive data from the server and deconstruct the data and address received
15
+data, addr = client.recvfrom(4906)
16
17
+print(data.decode(), addr)
18
19
+client.close()
0 commit comments