From: Robert Klemme Date: 2005-09-17T18:56:41+09:00 Subject: Re: sending EOF portably Ara.T.Howard wrote: > On Sat, 17 Sep 2005, Robert Klemme wrote: > >> Ara.T.Howard wrote: >>> any way to send EOF down a pipe/io object in a portable fashion? i >>> want to signal EOF to another process w/o closing/reopen. >> >> There seems to be ETX, EOT, EM, FS... in ASCII but I dunno how >> portable that is. >> http://www.lookuptables.com/ > > yeah... but you can't actually send those... > >> If you control both processes you can use whatever convention you >> like. Other than that it'll be difficult. > > i don't think i can - the input/output could be any binary data so no > sequence of chars will do. Well, if you have control you can introduce any protocol (even efficient ones) that will work. For example you can simply use an escape character. If you search the web for "mulitplexing on a single stream" you might find viable solutions, too. An alternative approach in your case would be to use UNIX domain sockets. They are limited to the local machine and I believe they are faster than TCP/IP sockets. This will also make handling on the server side easier if you have to server multiple clients *concurrently* - even if you initially prevent actual concurrency. (From your description it's not clear to me how you want to prevent two concurrent connections. I may be mistaken but I think there is no way to open a (named) pipe exculsively for writing.) Kind regards robert