From: "Ara.T.Howard" Date: 2005-09-17T22:01:36+09:00 Subject: Re: sending EOF portably On Sat, 17 Sep 2005, Robert Klemme wrote: > 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. i'll consider. > 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 don't think there is a good way to acheive high concurrency using ruby's thread with io intensive application. i do plan to try a socket implimentation however. i just want to to K.I.S.S though so we'll see. > I may be mistaken but I think there is no way to open a (named) pipe > exculsively for writing.) open('fifo','w').flock File::FILE_EX or require 'posixlock' open('fifo','w').posixlock File::FILE_EX doesn't _open_ it exclusively but it does prevent multiple writers - which is sufficient. in my case i just have an auxillary file for this purpose - a filesystem semaphore if you will. cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================