delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/03/03/09:23:26

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 03 Mar 2008 15:22:40 +0100
From: spambouncer AT gmx DOT de
Message-ID: <20080303142240.137090@gmx.net>
MIME-Version: 1.0
Subject: open() FIFO not blocking
To: cygwin AT cygwin DOT com
X-Authenticated: #24403641
X-Flags: 0001
X-Mailer: WWW-Mail 6100 (Global Message Exchange)
X-GMX-UID: hzH6dr8GYmYBf49pEXY3qWZCWkZTQRSI
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hi everyone!

Using the cygwin API on WinXP, I'm trying to set up communication between a client and a server app via a FIFO. Although the open() calls are supposed to block until the other end of the FIFO is connected, they return immediately. 
What's wrong? 

Here's the source code for the client app. The server app basically does the same, except for opening the FIFO with O_RDONLY.


#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>

#include <iostream>
using namespace std;


const char FIFO_NAME[]="SomeFifo";


int main(int argc, char* argv[])
{
	if(mkfifo(FIFO_NAME, 0666) != 0)
	{
		if(errno!=EEXIST)
		{
			perror("client: mkfifo");
			return -1;
		}
	}

	cout << "client: waiting for readers..." << endl;
	int fd=open(FIFO_NAME, O_WRONLY);
	if(fd==-1)
	{
		perror("client: open");
		return -1;
	}
	cout << "client: got a reader!" << endl;

	// write stuff to the fifo

	return 0;
}




-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019