summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send')
-rwxr-xr-xBuild/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send25
1 files changed, 25 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send b/Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send
new file mode 100755
index 00000000000..a594944c833
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send
@@ -0,0 +1,25 @@
+#!/usr/bin/lua
+
+--[[
+Show that luasocket returns an error message on zero-length UDP sends,
+even though the send is valid, and in fact the UDP packet is sent
+to the peer:
+
+% sudo tcpdump -i lo -n
+tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
+listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
+13:40:16.652808 IP 127.0.0.1.56573 > 127.0.0.1.5432: UDP, length 0
+
+]]
+
+require"socket"
+
+s = assert(socket.udp())
+r = assert(socket.udp())
+assert(r:setsockname("*", 5432))
+assert(s:setpeername("127.0.0.1", 5432))
+
+ssz, emsg = s:send("")
+
+print(ssz == 0 and "OK" or "FAIL",[[send:("")]], ssz, emsg)
+