aboutsummaryrefslogtreecommitdiff
path: root/examples/udp.client
diff options
context:
space:
mode:
Diffstat (limited to 'examples/udp.client')
-rw-r--r--examples/udp.client11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/udp.client b/examples/udp.client
new file mode 100644
index 0000000..32dbc02
--- /dev/null
+++ b/examples/udp.client
@@ -0,0 +1,11 @@
+# Example of sending from an unconnected socket
+
+set s [socket dgram]
+
+foreach i [range 1 20] {
+ # Specify the address and port with sendto
+ $s sendto "$i + $i + 10" 127.0.0.1:20000
+
+ # Receive the response - max length of 100
+ puts [$s recvfrom 100]
+}