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 16:59:19 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On May 14, 2005, at 4:36 PM, Bijoy Thomas wrote:
> Hi,
>
> How can i tell soreceive to get me whatever data has come upto a
> maximum length. I am trying to receive data from a server and the
> maximum length of data it can send is 100 bytes. If i specify
> auio.uio_resid = 100 and the server sends less than 100 bytes, the
> soreceive blocks. If i give a small value like 50 and the server
> sends 75 bytes, i miss out on the remaining 25 bytes. The flag is
> am using is MSG_WAITALL and I am using mbufs to receive my data.
> Should i try a soreceive with MSG_PEEK, get the length of data and
> then use that length to call soreceive?
>
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.
HTH.
Brian Bergstrand
<http://www.bergstrand.org/brian/> PGP Key ID: 0xB6C7B6A2
-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.0.1 (Build 2130)
iQA/AwUBQoZ0vXnR2Fu2x7aiEQLP8QCeM2wsh6mIbDi514BBMV4MkJtSR/kAoOxB
eBJFV8TZ3sJqlN1UzwXqcNW2
=30xf
-----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