lkml.org 
[lkml]   [2002]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: want opinions on possible glitch in 2.4 network error reporting
"Richard B. Johnson" wrote:

[snip]
> Hackers code sendto as:
> sendto(s,...);
> Professional programmers use:
> (void)sendto(s,...);
>
> checking the return value is useless.
>
> Note that the man-page specifically states that ENOBUFS can't happen.

I don't know what your manpage says, but my manpage doesn't say anything about
ENOBUFS not being possible. From the man page:

"ENOBUFS The system was unable to allocate an internal memory block. The
operation may succeed when buffers become available."

> You cannot assume that any sendto() data actually gets on the wire, much
> less to its destination. With any user-datagram-protocol, both ends,
> sender and receiver, have to work out what they will do with missing
> packets and packets received out-of-order.

Hmm. I knew you couldn't assume it was delivered (the man page says so), but I
didn't know it doesn't guarantee it getting to the wire. The man page says that
"locally detected errors are indicated by a return value of -1". Furthermore,
it also says "When the message does not fit into the send buffer of the socket,
send normally blocks, unless the socket has been placed in non-blocking I/O
mode."

I would suggest that if the packet doesn't make it onto the wire, sendto()
should either a) block until it can send the packet (or return with EAGAIN, as
appropriate), or b) return an error.

Chris


--
Chris Friesen | MailStop: 043/33/F10
Nortel Networks | work: (613) 765-0557
3500 Carling Avenue | fax: (613) 765-2986
Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:24    [W:0.468 / U:0.412 seconds]
©2003-2011 Jasper Spaans. Advertise on this site