Re: receiving data with soreceive
Re: receiving data with soreceive
- Subject: Re: receiving data with soreceive
- From: Brian Bergstrand <email@hidden>
- Date: Sat, 14 May 2005 17:59:44 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On May 14, 2005, at 5:39 PM, Justin Walker wrote:
>
> On May 14, 2005, at 15:22, Bijoy Thomas wrote:
>
>>> Are you calling soreceive in an so upcall? If so, try setting
>>> MSG_DONTWAIT in the flags, and that should give you everything that
>>> is in the so buf at that point. MSG_DONTWAIT tells the socket not to
>>> block. For the auio resid, use M_COPYALL.
>>>
>
> This is an alternative, but keep in mind that using this means that
> your code has to make sure all the data you need is in place,
> essentially by reconstructing the incoming packet byte-by-byte
> (i.e., you need to make sure enough bytes are present to form a
> valid header so you can read the length, so you can make sure
> enough bytes are present to process the rest of the packet, ....).
> It also means you are polling for data, which may not be the best
> idea.
>
> Cheers,
>
> Justin
>
Hmm, don't know where you got the polling from. upcalls are event
based, so when there is data to read (or the sock is ready for
writing) your upcall (callback) is called. If all of the data is not
in the socket at that point, you buffer it and wait for the next
event. No polling involved. However it does mean more work on your
part because everything is async.
Bijoy: Definitely get Stevens' TCP book as Justin recommended -- this
is all covered in detail.
Brian Bergstrand
<http://www.bergstrand.org/brian/> PGP Key ID: 0xB6C7B6A2
-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.0.1 (Build 2130)
iQA/AwUBQoaC6nnR2Fu2x7aiEQJsJQCgjVA6tN8qdfqP9RS2KQiqiTrFvyUAnjcd
AwNZPhnBaZUJWlvQIchE6kRa
=zVVH
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden