home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / question / 10213 < prev    next >
Encoding:
Internet Message Format  |  1992-08-20  |  1.4 KB

  1. Path: sparky!uunet!seismo!darwin.sura.net!mips!news.cs.indiana.edu!nstn.ns.ca!dragon.acadiau.ca!880126b
  2. From: 880126b@dragon.acadiau.ca (Chris Butler)
  3. Newsgroups: comp.unix.questions
  4. Subject: Faking an EOF
  5. Keywords: sockets
  6. Message-ID: <1992Aug20.132305.22177@dragon.acadiau.ca>
  7. Date: 20 Aug 92 13:23:05 GMT
  8. Organization: Acadia University
  9. Lines: 27
  10.  
  11. OK, here goes...
  12.  
  13. I'm writing an application that gets the output of a command across 
  14. a socket.  What I want to do is to be able to have a loop on the
  15. client side like this:
  16.  
  17. while(fgets(buffer, BUFSIZE, f) != NULL)   /* f is a file descriptor
  18.                                             * that reads from the socket.
  19.                                             */
  20.    print("%s", buffer);
  21.  
  22.  
  23. On the other end of the socket, I do a popen() and read from the
  24. file descriptor and throw everything into the socket. 
  25.  
  26. What I want is some ioctl or fcntl thing that will "fake" an EOF
  27. on the socket so fgets will recognize it, but still be able to 
  28. use the socket afterwards.  Is this possible?  Please e-mail, and
  29. I'll summarize if there's any interest.
  30.  
  31. -Chris
  32.  
  33. -- 
  34. Chris Butler                                   chris.butler@dragon.acadiau.ca
  35. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  36.      "Then you admit confirming not denying you ever said that?" 
  37.      "NO! I mean Yes! WHAT?"  "I'll put `maybe.'" -- Calvin & Hobbes
  38.