LuaSocket : What does unconnected:sendto function return?

695 Views Asked by At

The docs say

If successful, the method returns 1. In case of error, the method returns nil followed by an error message.

I get a return value of 5. Even when nil is returned, no error message is returned...

What does "5" return value mean? No. of packets sent or something?

EDIT

Here's a gist of the code.

local UDPClient = socket.udp()
UDPClient:setsockname("*", 0) --bind on any availible port and localserver ip address.
UDPClient:settimeout(0)
UDPClient:sendto(json.encode{"a"},someIP,somePort) 
1

There are 1 best solutions below

2
On BEST ANSWER

On my computer it returns number of bytes sent in the call. It is weird, indeed, as specification says something completely different.