mirror of
https://github.com/lunarmodules/luasocket.git
synced 2025-07-13 14:14:30 +02:00
Compare commits
5 Commits
6a646f62a6
...
issue297
Author | SHA1 | Date | |
---|---|---|---|
3a66baed15 | |||
790a58112f | |||
d341493bbf | |||
0901c486ff | |||
68aeb39dc2 |
@ -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())
|
||||
|
Reference in New Issue
Block a user