This is the mail archive of the
cygwin
mailing list for the Cygwin project.
open() FIFO not blocking
- From: spambouncer at gmx dot de
- To: cygwin at cygwin dot com
- Date: Mon, 03 Mar 2008 15:22:40 +0100
- Subject: open() FIFO not blocking
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/