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