Re: how do I call soreceive?
Re: how do I call soreceive?
- Subject: Re: how do I call soreceive?
- From: Bijoy Thomas <email@hidden>
- Date: Mon, 9 May 2005 16:13:30 -0400
Hi,
Thanks for all your suggestions. I made the wrong asusmption that
return values were negative .. so i was doing
if(soconnect(args) < 0){
printf("bad socket");
}
when actually soconect was returning EINVAL (bad arg) because i forgot
to fill the sin_len field of my sockaddr_in argument. Hence, the
ensuing soreceive was returning ENOTCONN (not connected). Now thats
fixed and my soconnect returns 0. The problem now is that my userland
program seems to be sleeping because after hitting ctrl-C, the return
value from soreceive is EINTR. Hence, i guess my program is blocked by
soreceive. I have a couple of questions
If we are using a tcp socket, do we need to provide the second arg for
soreceive or is that only for udp sockets.
Am i correct in my assumtion that as long as i care only about the
data, i just need to provide the struct uio arg for sorecieve with its
iovec filed initialzed to my kernel space buffer and its length and
setting uio_segflg = UIO_SYSSPACE and uio_rw = UIO_READ. In this case
the mbufs can be NULL in the call to soreceive.
Also, why do we use the uio_resid field in the struct iuo? Is it used
in multiple calls. Can we just set it to the buffer length on the first
call?
I was using the flag MSG_WAITALL for the soreceive. Will that cause the
soreceive to stall until all data arrives? Is there a default flag for
just returning whatever data has arrived.
I know I am jumping ahead of myself without understanding the workings
of soreceive. I have alredy placed an order for the design of the bsd
os book. But until then, I would be grateful if anyone could answer
these.
Thanks in advance
Bijoy Thomas.
On May 9, 2005, at 2:49 PM, Justin Walker wrote:
On May 9, 2005, at 11:38, Bijoy Thomas wrote:
[snip]
and passing this so soreceive with both the mbufs as NULL. ( I'm
guessing the mbufs are provided only if you want the detailed packet
header and accompanying data returned possibly as a list of mbufs). I
tried it this way but i'm getting a non zero return from soreceive.
Any suggestions/links?
My first suggestion is to actually look at, and understand, the
non-zero return value you get from soreceive(). If you don't
understand the value, it might help to let us know what it is.
Regards,
Justin
--
Justin C. Walker, Curmudgeon-at-Large
/~\ The ASCII
\ / Ribbon Campaign
X Help Cure HTML Email
/ \
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
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