apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Lazic <al-...@none.at>
Subject Re: [Fwd: Re: How to detect is the socket is still open]
Date Wed, 16 Aug 2006 08:54:06 GMT
On Mit 16.08.2006 08:55, Joe Orton wrote:
>
>POLLERR would only be set for an RST and "exceptional conditions"; the
>same applies to select()+the exceptfds array AFAIK.
>
>There is some inconsistency with handling FIN and sockets across
>platforms: http://www.greenend.org.uk/rjk/2001/06/poll.html but yes
>you'd generally expect POLLIN for "you can read EOF".

On curl-library list there was a similar thread about poll on MacOsX:

'poll & Mac OS X 10.4'
http://curl.haxx.se/mail/lib-2005-05/index.html#118

There was a link to mac develop site:

http://developer.apple.com/technotes/tn2002/tn2071.html

---
.
.
poll

This API is not supported in Mac OS X, instead, the function select is
used. The select function does synchronous I/O multiplexing, similar to
poll. This API is located in the following header files: <sys/types.h>,
<sys/time.h>, <unistd.h> The select API is defined as follow: 

---
int select(int nfds, fd_set *readfds, fd_set *writefds,
       fd_set *exceptfds, struct timeval *timeout);
---

The behavior of select is not exactly the same as poll, so you will have
to alter your code. select gives you a number of macros to manipulate
the file descriptor returned, which is done differently in poll

An alternative to avoid changing your code is to use a wrapper around
select, such as fakepoll.h. Simply include the file fakepoll.h in your
code, and the library does the rest of the work. See
sealiesoftware.com/fakepoll.h for more information about fakepoll.h.

Note: fakepoll.h is a third-party library and not supported by Apple.
.
.
---

regards

Alex

Mime
View raw message