aboutsummaryrefslogtreecommitdiff
path: root/test/tcp-getoptions
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2012-04-11 14:18:20 -0700
committerSam Roberts <vieuxtech@gmail.com>2012-04-11 14:18:20 -0700
commit4b671f4551e98ac9e1d9a7407d3dffdd7eb1d3dc (patch)
treeba92aa753ae1b145760cb1c5e69c886d3bf11328 /test/tcp-getoptions
parentf399ab25fcecad2ff96a5977e8eaf069bb45473c (diff)
parent195b2a74bb3f368b1f31f9c8bbc1ce0f54de2035 (diff)
downloadluasocket-4b671f4551e98ac9e1d9a7407d3dffdd7eb1d3dc.tar.gz
luasocket-4b671f4551e98ac9e1d9a7407d3dffdd7eb1d3dc.tar.bz2
luasocket-4b671f4551e98ac9e1d9a7407d3dffdd7eb1d3dc.zip
Merge branch 'git-sam' into diego-sam-mwild-integration
Conflicts in options.c were just due to independent small functions being close to each other. unix.c in mwild was broken, it wasn't using LUASOCKET_API. serial.c needed luaL_reg renamed, and to use LUASOCKET_API. makefile didn't respect standard DESTDIR and prefix makefile variables, and didn't allow LUAV variable to select lua version to build against. I've tested the top-level install-both target builds and installs against both lua5.1 and lua5.2, but not done further testing. Conflicts: README config gem/ltn012.tex makefile src/makefile src/options.c src/options.h src/tcp.c src/usocket.c
Diffstat (limited to 'test/tcp-getoptions')
-rwxr-xr-xtest/tcp-getoptions41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/tcp-getoptions b/test/tcp-getoptions
new file mode 100755
index 0000000..f9b3d1b
--- /dev/null
+++ b/test/tcp-getoptions
@@ -0,0 +1,41 @@
1#!/usr/bin/env lua
2
3require"socket"
4
5port = 8765
6
7function options(o)
8 print("options for", o)
9
10 for _, opt in ipairs{"keepalive", "reuseaddr", "tcp-nodelay"} do
11 print("getoption", opt, o:getoption(opt))
12 end
13
14 print("getoption", "linger",
15 "on", o:getoption("linger").on,
16 "timeout", o:getoption("linger").timeout)
17end
18
19local m = socket.tcp()
20
21options(m)
22
23assert(m:bind("*", port))
24assert(m:listen())
25
26options(m)
27
28m:close()
29
30local m = socket.bind("*", port)
31
32options(m)
33
34local c = socket.connect("localhost", port)
35
36options(c)
37
38local s = m:accept()
39
40options(s)
41