home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / wizards / 3328 < prev    next >
Encoding:
Text File  |  1992-07-27  |  1.6 KB  |  45 lines

  1. Newsgroups: comp.unix.wizards
  2. Path: sparky!uunet!island!coney!hue
  3. From: hue@island.COM (Pond Scum)
  4. Subject: Re: Out-of-band data on sockets
  5. Message-ID: <hue.712262869@coney>
  6. Sender: usenet@island.COM (The Usenet mail target)
  7. Organization: Island Graphics Corp.
  8. References: <1992Jul17.090725.246@gamelan> <1992Jul21.141619.12933@Newbridge.COM>
  9. Date: Mon, 27 Jul 1992 18:47:49 GMT
  10. Lines: 33
  11.  
  12. todds@Newbridge.COM (Todd Sandor) writes:
  13. >Similiar problems exist with SunOS 4.1.1.  With SunOS, the select returnsindicating OOB data, then read the OOB data (all is OK), then go into
  14. >the select again and select returns with OOB data pending (nothing
  15. >has been sent).  If try to read the OOB data you get a an error with
  16. >errno indicating an Invalid argument.
  17.  
  18. You can clear the exception by doing a normal recv after you do the recv
  19. with MSG_OOB.  I've got the following two fragments of code in one of my
  20. programs:
  21.  
  22.     send(s, &m, 1, MSG_OOB);
  23.     send(s, &m, 1, 0);      /* wizard test - what do you think this is for? */
  24.                 /* hint: see source code to telnet */
  25.  
  26. and
  27.  
  28.     if ((n = select(nfds, 0, 0, &emask, &zerot)) > 0)
  29.     {
  30.     if ((n = recv(sock, buf, sizeof(buf), MSG_OOB)) < 0)
  31.         perror("recv");
  32.     read(sock, buf, 1);  /* wizard test - What do you think this is for? */
  33.  
  34.  
  35. I send a useless byte of garbage so the receiver can read it and clear the
  36. exception.
  37.  
  38. >(Problem is the select with exception-fd enabled will ALWAYS return with
  39. >something to read after the first OOB data is received - reading the
  40. >OOB data makes no difference).
  41.  
  42. This is under SunOS 4.1.1.
  43.  
  44. -Jonathan        hue@island.COM
  45.