lua-users home
lua-l archive

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


On 2014-07-27 8:09 PM, "Paul K" <paul@zerobrane.com> wrote:
>
> > I would have expected a zero timeout to behave as unlimited.
>
> As far as I understand, only "nil" and negative values have that
> effect (http://w3.impa.br/~diego/software/luasocket/tcp.html#settimeout).
>
> Paul.
>
> On Sun, Jul 27, 2014 at 4:39 PM, Coda Highland <chighland@gmail.com> wrote:
> > On Sun, Jul 27, 2014 at 4:20 PM, Paul K <paul@zerobrane.com> wrote:
> >>> What's the expected behavior of a zero timeout? I would expect it to
> >>> never succeed at all, because no packet ever has zero latency.
> >>
> >> It would be the same as for a small timeout; I'd expect "nil, timeout"
> >> to be returned with copas taking care of that. Even using 0.000001 as
> >> the timeout value works, but not 0.
> >
> > I would have expected a zero timeout to behave as unlimited.
> >
> > /s/ Adam
> >
>

I think usually with sockets, a timeout of zero means return any packets that have already arrived in the receive buffer, but if there aren't any, don't wait around for one.