zlib: Don't use PASTE for INTMAX error messages
[jimtcl.git] / examples / udp6.server
blobda9b4bf8764c2316cbec2689a4ce49e6e773771b
1 # Example of a udp server listening on ipv6 which sends a response
2 # Note that on many hosts, this will also respond to ipv4 requests too
4 # Listen on port 20000.
5 set s [socket -ipv6 dgram.server {[::]:20000}]
7 # For each request...
8 $s readable {
9         # Get the request (max 80 chars) - need the source address
10         set buf [$s recvfrom 80 addr]
12         puts -nonewline "read '$buf' from $addr"
14         try {
15                 set result "$buf = [expr $buf]"
16         } on error {msg} {
17                 set result "Error: $buf => $msg"
18         }
20         puts ", sending '$result'"
22         # Send the result back to where it came from
23         $s sendto $result $addr
26 vwait done