[Libevent-users] event-test on OS X

js ebgssth at gmail.com
Sat Apr 19 09:02:47 EDT 2008


Hi,

I found event-test sample doesn't work on OS X.
It seems this is a known problem because I found similar report
on the list:
http://monkeymail.org/archives/libevent-users/2006-October/000259.html

The report above suggests using fcntl to get REAL O_NONBLOCK,
so I added the code below

	if ((flags = fcntl (socket, F_GETFL, 0)) == -1) {
		perror("fcntl");
		exit (1);
	}

	flags |= O_NONBLOCK;

	if (fcntl (socket, F_SETFL, flags) == -1) {
		perror("fcntl");
		exit (1);
	}

but it didn't work for me.
and I confirmed that open(O_NONBLOCK) set O_NONBLOCK
to socket succesfully by using fcntl F_GETFL.
I'm stuck.

Any clues?


More information about the Libevent-users mailing list