June 30th, 2008, 08:40 AM
Recvmsg to read only control information ,without reading any data
I was trying to figure out the process id of the client process using SO_PASSCRED socket option on the server socket. The pid would be read as control information in recvmsg.
But I have a problem. I want to get this information only once, when a client connects to the server for the first time. The read api, I have does a read every time some data is written on the socket.
Is there a way to call recvmsg just to read the SCM_CREDENTIALS control information without reading any data i.e. can we pass msg_iov as null, msg_iovlen = 0 and just set msg_control and msg_controllen.
Thanks in advance..