Re: Getting destination socket address

From: Andreas Gaupmann (andreas.gaupmann@private)
Date: Mon Feb 06 2006 - 06:18:47 PST


Hello!

On Monday 06 February 2006 12:46, Andreas Gaupmann wrote:
> What is the explanation for msg->msg_name not being initialized all the
> time? Is this field filled after the discussed hook function has already
> been called?
> How can the destination socket of the message be determined despite
> msg->msg_name equal to NULL?
>
OK, I have found the answer. Destination socket addresses for datagram sockets 
can be specified in two ways:

1) Use a msghdr structure and set the msg_name member.
2) Make a call to connect() with a defined socket address and set msg_name to 
NULL. Subsequent calls to sock_sendmsg will use this address as destination.

In case 1 the hook function socket_sendmsg() will be called with an 
initialized msg_name. Case 2 explains why the msg_name field can be NULL. In 
case 2 the hook funtion socket_connect() must be used.

That's probably all that is to it.

Regards
Andreas Gaupmann



This archive was generated by hypermail 2.1.3 : Mon Feb 06 2006 - 06:19:22 PST