HELP: "recvmsg" and "struct msghdr" questions

HELP: "recvmsg" and "struct msghdr" questions

Post by PA » Thu, 07 Feb 2002 12:29:25



I am trying to understand how recvmsg works. Basically,
I need to get the interface index when I receive an
IP packet from a raw socket.

I set up a buffer of a size 64K (maximum IP packet size).
I assign the buffer to iov_base and the size (64K) to
iov_len. Is there a maximum size that iov_base can point to?

Then msg_control points to sockaddr_dl so that the stack
will put in the interface index.

Am I doing anything wrong here? Besides, when I call sendmsg,
do I also need to setup the msghdr as well? Is there any
working code that I can referene to?

Any help is greatly aprpeciated. Many thanks.

Paul