I'm trying to pass fd between process and I found the sample code like portlisten. In the sample, a recvmsg()
can take a bound socket as parameter (and leave msghdr.msg_name as NULL) but the sendmsg()
cannot - it must take a sockaddr*
in the msghdr.msg_name.
I tried to modify the program by connecting first but failed, and found the comment as /* doesn't do anything at the moment
but I don't understand why.
Is this a limitation of sendmsg() that it cannot take an already connected socket as parameter?