summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send-recv
diff options
context:
space:
mode:
authorLuigi Scarso <luigi.scarso@gmail.com>2018-01-17 18:00:12 +0000
committerLuigi Scarso <luigi.scarso@gmail.com>2018-01-17 18:00:12 +0000
commitf100e939b3262ac391fe767d591d1a316ab59f3a (patch)
tree53787d7aa79da3a8b10df0049cfe623cf0f2bd89 /Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send-recv
parent345e6b3ddab394ae88cd0d916992bc2bc0f8695d (diff)
Luatex 1.07 --- luatex and luatex53
git-svn-id: svn://tug.org/texlive/trunk@46348 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send-recv')
-rwxr-xr-xBuild/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send-recv37
1 files changed, 37 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send-recv b/Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send-recv
new file mode 100755
index 00000000000..541efd43259
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/luasocket/test/udp-zero-length-send-recv
@@ -0,0 +1,37 @@
+#!/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))
+
+ok, emsg = s:send("")
+if ok ~= 0 then
+ print("send of zero failed with:", ok, emsg)
+end
+
+assert(r:settimeout(2))
+
+ok, emsg = r:receive()
+
+if not ok or string.len(ok) ~= 0 then
+ print("fail - receive of zero failed with:", ok, emsg)
+ os.exit(1)
+end
+
+print"ok"
+