lua-users home
lua-l archive

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


Hi,

> Why does this buffer need to be declared statically anyway? The
> sendto/receivefrom calls have size parameters, and the underlying socket
> calls return the amount they received/sent from/to the network stack?

For performance, and because UDP isn't like TCP. If you call recv but
doesn't provide a large enough buffer, that extra data is gone, forever.
The next function call will get the next packet. There might be some way
to find out the size of the message before calling recv, but I just
didn't think it was worth it. I have to agree with you that I should
raise the packet size to the maximum IP packet size and let the users
decide what is safe and what isn't. I might do just that.

[]s,
Diego.