X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Message-ID: <49E864F3.1070803@romandie.com> Date: Fri, 17 Apr 2009 13:16:03 +0200 From: Philipp User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Accessing fifo pipes from windows programs Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hello, I have some problems accessing a fifo file from my Java program. Fifos work correctly with cygwin tools, example: $ mkfifo fifo $ echo 'hello' >> fifo This blocks. In another shell, I do: $ cat fifo hello So this works fine. It unblocks the echo and writes the "hello". Now trying the same thing with my java app: $ mkfifo fifo $ ls -l total 1 prw-rw-rw- 1 Phil Aucun 0 Apr 17 12:58 fifo Starting the producer (code at end of post): $ java -cp .. DateWriter fifo Fri Apr 17 13:02:20 CEST 2009 Fri Apr 17 13:02:21 CEST 2009 [...] It does not block but writes into a second file instead $ ls -l total 2 -rwxr-xr-x 1 Phil Aucun 120 Apr 17 13:02 fifo -rwxr-xr-x 1 Phil Aucun 120 Apr 17 13:02 fifo Two files with the same name... The last-modif date of the original fifo is modified, but the content is in the first. When viewed with Windows explorer, one is a shortcut (with comment :\0:fc:11b6) and the other a pure text file. How can I access the named pipe correctly from my Java program? Correctly means, that writing in the Java blocks while nobody is listening. Thanks for your answers. Phil Full Java code of producer: import java.io.File; import java.io.FileWriter; import java.util.Date; public class DateWriter { public static void main(String[] args) throws Exception{ File fifo = new File(args[0]); FileWriter writer = new FileWriter(fifo); while(true){ String toWrite = new Date() + "\n"; System.out.print(toWrite); writer.write(toWrite); writer.flush(); Thread.sleep(1000); } } } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/