Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
|
3a66baed15 | ||
|
790a58112f | ||
|
d341493bbf | ||
|
0901c486ff | ||
|
68aeb39dc2 |
4 changed files with 24 additions and 10 deletions
|
@ -10,7 +10,7 @@ ulimit -n
|
|||
You'll probably need to be root to do this.
|
||||
]]
|
||||
|
||||
require "socket"
|
||||
socket = require "socket"
|
||||
|
||||
host = arg[1] or "google.com"
|
||||
port = arg[2] or 80
|
||||
|
|
|
@ -1,21 +1,35 @@
|
|||
#!/usr/bin/env lua
|
||||
|
||||
require"socket"
|
||||
local socket = require"socket"
|
||||
|
||||
port = 8765
|
||||
|
||||
function pcalltest(msg, o, opt)
|
||||
local a = { pcall(o.getoption, o, opt) }
|
||||
if a[1] then
|
||||
print(msg, opt, unpack(a))
|
||||
else
|
||||
print(msg, opt, 'fail: ' .. a[2])
|
||||
end
|
||||
end
|
||||
|
||||
function options(o)
|
||||
print("options for", o)
|
||||
|
||||
for _, opt in ipairs{
|
||||
"keepalive", "reuseaddr",
|
||||
"tcp-nodelay", "tcp-keepidle", "tcp-keepcnt", "tcp-keepintvl"} do
|
||||
print("getoption", opt, o:getoption(opt))
|
||||
pcalltest("getoption", o, opt)
|
||||
end
|
||||
|
||||
print("getoption", "linger",
|
||||
"on", o:getoption("linger").on,
|
||||
"timeout", o:getoption("linger").timeout)
|
||||
r = o:getoption'linger'
|
||||
if r then
|
||||
print("getoption", "linger",
|
||||
"on", r.on,
|
||||
"timeout", r.timeout)
|
||||
else
|
||||
print("getoption", "linger", "no result")
|
||||
end
|
||||
end
|
||||
|
||||
local m = socket.tcp()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/lua
|
||||
#!/usr/bin/env lua
|
||||
|
||||
--[[
|
||||
Show that luasocket returns an error message on zero-length UDP sends,
|
||||
|
@ -12,7 +12,7 @@ listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
|
|||
|
||||
]]
|
||||
|
||||
require"socket"
|
||||
socket = require"socket"
|
||||
|
||||
s = assert(socket.udp())
|
||||
r = assert(socket.udp())
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/lua
|
||||
#!/usr/bin/env lua
|
||||
|
||||
--[[
|
||||
Show that luasocket returns an error message on zero-length UDP sends,
|
||||
|
@ -12,7 +12,7 @@ listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
|
|||
|
||||
]]
|
||||
|
||||
require"socket"
|
||||
socket = require"socket"
|
||||
|
||||
s = assert(socket.udp())
|
||||
r = assert(socket.udp())
|
||||
|
|
Loading…
Add table
Reference in a new issue