Determining EOF character

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Mon Feb 19 16:14:02 EST 2001


Sun, 18 Feb 2001 20:30:35 -0800, Daniel Klein <danielk at aracnet.com> pisze:

> I don't want to terminate the connection, I only want to know when
> the server (child) process has stopped sending.

You must invent your own way of signalling this. A way which does not
interfere with normal data. There is no other system-wide concept of
stopping sending than closing the connection.

When you press ^D on a Unix terminal, it is not sent in the stream.
It only flushes the line without '\n' at the end. If it was pressed
at the beginning of a line (or after a previous ^D), the read()
syscall returns 0, which is interpreted as the end of file.

The file is not physically closed - the process can read further.
But I think it works only for terminals and such signal cannot be
sent through a pipe. The read end returns 0 only when the write end
closes its pipe handle, and no character is treated specially.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list