tags:

views:

42

answers:

1

We're developing a cross-platform network application that needs to send and receive data over TCP. On linux we are using select() to wait on both send and receive to make sure that the socket is ready. However, on OSX the select for read takes an absurd amount of time to return -- over 20 seconds. select() isn't timing out -- our timeout is 60 seconds and the data is coming back, it's just ridiculously slow. This only happens for reads, not sends. The network appears to be fine (again, the linux machine on the same network does not seem to have the same issues).

Is anyone aware of any caveats using socket programming in OSX?

+1  A: 

Have you tried kqueue(2) on OSX and epoll(7) on Linux? These are much more performant and flexible, though platform-specific, interfaces for I/O event handling. You might also take a look at libevent that abstracts all this for you.

Nikolai N Fetissov
the question was really answered by Daniel above but I'm marking this as an answer because it *would* have been the answer otherwise. thanks.
wickedchicken