Re: Socket read tuning on Mac OS X
Re: Socket read tuning on Mac OS X
- Subject: Re: Socket read tuning on Mac OS X
- From: Terry Lambert <email@hidden>
- Date: Fri, 2 Apr 2010 17:01:27 -0700
On Apr 2, 2010, at 4:06 PM, Terry Lambert wrote:
On Apr 2, 2010, at 7:18 AM, Jakub Bednar wrote:
I have tried SO_RCVLOWAT along with SO_RCVTIMEO options, but this
is not the way. Poll() does not respect SO_RCVLOWAT and the socket
will not give me less data but return an error when
SO_RCVTIMEO timeout expires.
SO_RCVLOWAT only applies to UNIX domain sockets or FIFOs, where
there is not potentially an administrative or system limit that will
prevent enough data accumulating in order to satisfy the low
watermark. It's going to have no effect because it's not supposed
to have any effect: you could starvation deadlock yourself
otherwise, which could be used to stage a local DOS. This is true
on most other UNIX-like systems as well. One exception is "accept
filters"-based systems with kernel pre-parsing of data contents for
recognition of complete messages; another is the NCP streams MUX in
NetWare for UNIX, which also recognizes complete messages, and does
not send unchunked data up to user space. These are dangerous from
a security perspective because they allow a user space process to
download interpreted code intended to run in supervisor mode.
NB: As To A.M.'s suggestion, the NOTE_LOWAT for kqueue() is only
respected for sockets, pipes, and BPF (Berkeley Packet Filter);
unless you are doing raw ethernet frames via BPF, this will
unfortunately not help you out.
I spoke too soon here, and misrepresented things.
A.M.'s suggestion isn't going to work if the poll() didn't work as you
note.
The SO_RCVLOWAT is supposed to work on all sockets, so why it seems to
not be working in your case is at this point unknown; there are a
couple of theories so far. Stay tuned.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden