In this case, sendto () on a UDP socket returns 0?

Is there a case where a call to sendto () on a UDP socket returns 0, and if so, what does that mean? Manual only says that on error it is -1, otherwise the number of bytes sent.

+4
source share
1 answer

You can send()/ sendto()get a message with a zero byte in the domain datagram or in the UDP socket, in which case the correct length of 0 bytes is correct. If you see this unexpectedly, check your lenparameter in your call sendto(int fd, void const *buf, size_t len, int flags, struct const *dest, sockles_t addrlen).

+5
source

Source: https://habr.com/ru/post/1540564/


All Articles