mirror of
https://github.com/lunarmodules/luasocket.git
synced 2025-07-13 06:04:31 +02:00
Fixed stupid bugs.
This commit is contained in:
@ -26,10 +26,11 @@ local function connect(localhost, option)
|
||||
if option.localbind then
|
||||
-- bind to a local port (if we can)
|
||||
local localport = 721
|
||||
local done, err
|
||||
repeat
|
||||
skt = test(socket.tcp())
|
||||
try(skt:settimeout(30))
|
||||
local done, err = skt:bind(localhost, localport)
|
||||
done, err = skt:bind(localhost, localport)
|
||||
if not done then
|
||||
localport = localport + 1
|
||||
skt:close()
|
||||
@ -38,6 +39,7 @@ local function connect(localhost, option)
|
||||
until localport > 731
|
||||
test(skt, err)
|
||||
else skt = test(socket.tcp()) end
|
||||
print("'" .. host .. "'")
|
||||
try(skt:connect(host, port))
|
||||
return { skt = skt, try = try }
|
||||
end
|
||||
|
Reference in New Issue
Block a user