home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / wizards / 3876 < prev    next >
Encoding:
Text File  |  1992-09-10  |  1.4 KB  |  44 lines

  1. Newsgroups: comp.unix.wizards
  2. Path: sparky!uunet!ftpbox!mothost!panther!panther4.panther.mot.com!asu
  3. From: asu@panther4.panther.mot.com (ASU Student)
  4. Subject: Stevens Book/ Passing File descriptors 
  5. Message-ID: <1992Sep10.161335.26883@panther.mot.com>
  6. Sender: usenet@panther.mot.com
  7. Nntp-Posting-Host: panther4.panther.mot.com
  8. Organization: Motorola Panther Project, Chandler, AZ
  9. Date: Thu, 10 Sep 1992 16:13:35 GMT
  10. Lines: 32
  11.  
  12.  
  13.  
  14. I've got a few questions for those who have tried the file descriptor
  15. passing example in R. Stevens UNIX Network Programming.  I've been having
  16. problems getting this to work reliably, 
  17. In his example, he had a structure similar to this:
  18.  
  19.             struct iovec iov;
  20.             iov.iov_base = (char *)0; iov.iov_len = 0;
  21.         
  22.             int fd;    
  23.             struct msghdr msg;
  24.             msg.msg_name = (caddr_t)0; msg.msg_namelen = 0;
  25.             msg.msg_iov = iov; msg.msg_iovlen = 1;
  26.             msg.msg_accrights = &fd; msg.msg_accrightslen = sizeof(int); 
  27.  
  28. Now my first question...is the msg.msg_iov field required to be non-NULL?
  29. I was trying this:
  30.  
  31.             msg.msg_iov = (struct iovec *)0; msg.msg_iovlen = 0;
  32.  
  33. But, it's unclear if this is the problem.   Has anyone tried passing
  34. file descriptors and gotten it to work reliably?  My system is SunOS 4.1.2. 
  35.  
  36. BTW, when I mean reliably, I mean that sometimes I get garbage messages
  37. with invalid descriptors.  But, the sendmsg()/recvmsg() would return no
  38. error in this case.
  39.  
  40. Thanks!
  41.  
  42. Russ
  43.             
  44.