lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Well thanks. I had looked at settimeout(), but the crucial documentation part was:

    Also, after the error message, the function returns the partial result of the transmission.
   
The following ugly hack fulfills my needs then. 

Thanks again. /Flemming

debug.getregistry()["tcp{client}"].__index.read = 
function(sock, pattern, ...)
   local str, err, part = sock:receive(pattern, ...)
   if not str and err == "timeout" then
      str = part
   end
   return str, err, part
end


On Thu, Mar 15, 2012 at 8:40 PM, Matthew Wild <mwild1@gmail.com> wrote:


Are you missing conn:settimeout(0)? If not, do you have a test case
where receive() blocks?