aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2012-02-27 13:26:23 -0800
committerSam Roberts <vieuxtech@gmail.com>2012-04-11 13:54:01 -0700
commit8bb542baaf30874479b83d37af2fea5fa84d0a8e (patch)
tree117d706140ee622565fa1c671c5469cb7f30fdac /test
parent0716cb868e847bb9f66c659f8662d905ba012de8 (diff)
downloadluasocket-8bb542baaf30874479b83d37af2fea5fa84d0a8e.tar.gz
luasocket-8bb542baaf30874479b83d37af2fea5fa84d0a8e.tar.bz2
luasocket-8bb542baaf30874479b83d37af2fea5fa84d0a8e.zip
Support getoption method for tcp objects.
Diffstat (limited to 'test')
-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