Determining EOF character

Tim Roberts timr at probo.com
Sun Feb 18 21:44:21 EST 2001


Daniel Klein <danielk at aracnet.com> wrote:

>On Sun, 18 Feb 2001 11:35:41 -0800, Erik Max Francis <max at alcyone.com> wrote:
>
>>Daniel Klein wrote:
>>> On Windows the child process needs to send a ^Z in response to
>>> readlines() and
>>> on UNIX it needs to send ^D. I don't know what this is on MAC.
>>
>>This isn't the way you should signal end of file.  You should signal it
>>the client closing his end of the pipe.  In fact, what you suggest above
>>may work on Windows, but it won't work on UNIX -- under UNIX, an end of
>>file isn't indicated with a sentinel character in the stream, but rather
>>with an out-of-bounds indicator (the underlying file structure has an
>>end-of-file flag).
>
>I'm not sure what you mean by "You should signal it the client closing his end
>of the pipe". This is an interactive session with the client and server in
>constant communication. If I close the pipe, I can do no further processing.

I don't understand.  If the character you're waiting for doesn't terminate
the connection, then why use an O/S-dependent character at all?  Why not
just choose some arbitrary control character specific to your application.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list