home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.wizards
- Path: sparky!uunet!ftpbox!mothost!panther!panther4.panther.mot.com!asu
- From: asu@panther4.panther.mot.com (ASU Student)
- Subject: Stevens Book/ Passing File descriptors
- Message-ID: <1992Sep10.161335.26883@panther.mot.com>
- Sender: usenet@panther.mot.com
- Nntp-Posting-Host: panther4.panther.mot.com
- Organization: Motorola Panther Project, Chandler, AZ
- Date: Thu, 10 Sep 1992 16:13:35 GMT
- Lines: 32
-
-
-
- I've got a few questions for those who have tried the file descriptor
- passing example in R. Stevens UNIX Network Programming. I've been having
- problems getting this to work reliably,
- In his example, he had a structure similar to this:
-
- struct iovec iov;
- iov.iov_base = (char *)0; iov.iov_len = 0;
-
- int fd;
- struct msghdr msg;
- msg.msg_name = (caddr_t)0; msg.msg_namelen = 0;
- msg.msg_iov = iov; msg.msg_iovlen = 1;
- msg.msg_accrights = &fd; msg.msg_accrightslen = sizeof(int);
-
- Now my first question...is the msg.msg_iov field required to be non-NULL?
- I was trying this:
-
- msg.msg_iov = (struct iovec *)0; msg.msg_iovlen = 0;
-
- But, it's unclear if this is the problem. Has anyone tried passing
- file descriptors and gotten it to work reliably? My system is SunOS 4.1.2.
-
- BTW, when I mean reliably, I mean that sometimes I get garbage messages
- with invalid descriptors. But, the sendmsg()/recvmsg() would return no
- error in this case.
-
- Thanks!
-
- Russ
-
-