AwaLWM2M needs to be polled regularly to check for incoming data.
Since RIOT only supports timeout at the GNRC sock layer while
the network abstraction for RIOT in AwaLWM2M uses the posix layer,
this causes RIOT to be blocked waiting for data that never arrive.
This commit implements only the SO_RCVTIMEO option in setsockopt to
allow users to set a receive timeout for a socket at the posix layer.
Signed-off-by: Francois Berder <francois.berder@imgtec.com>
Commit de41971aab sets the default
timeout to 0. This change should not have been part of the commit.
Signed-off-by: Francois Berder <francois.berder@imgtec.com>
The address is an optional parameter of recvfrom. If it is
not null, recvfrom must store the address of the sender.
However this was only allowed if res was equal to 0, which
is wrong since res contains the number of bytes received
or -1.
This commit ensures that the address is set only if no
previous errors happened before.
Signed-off-by: Francois Berder <francois.berder@imgtec.com>
The return value of these functions was not always correct
in case of errors: they were not returning -1 and setting
errno.
Signed-off-by: Francois Berder <francois.berder@imgtec.com>
A client should not require to explicitly call bind() to receive packets, but is expected to receive replies sent to the ephemeral port that was selected as a source port by the UDP implementation.