lua:socket settimeout does not work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
luasocket (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Ubuntu Version: Ubuntu 14.04.2 LTS
package lua-socket:i386 3.0~rc1-3
On Ubuntu 14.04, lua socket settimeout does not work as expected. On a tcp socket, it causes the next receive to close the connection immediately.
It works correctly on Ubuntu 12.04 and debian 7.
To reproduce:
install packages lua5.1 and lua-socket
Take the echo server example from the introduction to luasocket:
http://
Put it in a file echo.lua and run it with "lua echo.lua"
From another window, use telnet localhost {port} to connect to the echo server
Result: Immediately after connecting, the server closes the connection.
Expected Result: The server should wait 10 seconds for input, then close the connection.
package version that works correctly in debian 7: lua-socket:i386 2.0.2-8
-------------
A copy of the example (echo.lua):
-- load namespace
local socket = require("socket")
-- create a TCP socket and bind it to the local host, at any port
local server = assert(
-- find out which port the OS chose for us
local ip, port = server:
-- print a message informing what's up
print("Please telnet to localhost on port " .. port)
print("After connecting, you have 10s to enter a line to be echoed")
-- loop forever waiting for clients
while 1 do
-- wait for a connection from any client
local client = server:accept()
-- make sure we don't block waiting for this client's line
client:
-- receive the line
local line, err = client:receive()
-- if there was no error, send it back to the client
if not err then client:send(line .. "\n") end
-- done with client, close the object
client:close()
end
affects: | unity (Ubuntu) → luasocket (Ubuntu) |
It works correctly in Ubuntu 12.04, using packages:
liblua5.1-socket2 2.0.2-6
lua5.1