PDA

View Full Version : C equivalent to Boost Asio?




Cromulent
Nov 6, 2010, 09:02 AM
Does anyone know if there is a C equivalent to Boost Asio at all? By that I mean a cross platform library that allows async network IO using the best method for each platform (kqueue on Mac and FreeBSD and epoll on Linux etc).

I haven't been able to find anything from Googling, does anyone have any suggestions at all?



Catfish_Man
Nov 6, 2010, 02:03 PM
/usr/include/sys/aio.h perhaps.

Cromulent
Nov 6, 2010, 03:55 PM
/usr/include/sys/aio.h perhaps.

Alas I have already looked at that but the real time extensions to the POSIX standard are for files only. At least that is what the man page for aio_write() says.

Mac Player
Nov 6, 2010, 06:22 PM
Check libevent and libaio .

subsonix
Nov 7, 2010, 12:46 PM
Alas I have already looked at that but the real time extensions to the POSIX standard are for files only. At least that is what the man page for aio_write() says.

Wouldn't any type of file descriptor work, such as sockets and so on?

Cromulent
Nov 17, 2010, 04:35 AM
Wouldn't any type of file descriptor work, such as sockets and so on?

Oops sorry for the late reply. I completely missed your response.

I took the man page at face value to be honest. Anyway I spent a little more time investigating this issue and basically decided that it came down to writing the entire server process in C (which is not a task I particularly relish) or using a language like Erlang which seems to be much better at handling such systems.

Another plus side to using Erlang is that it seems to be the first functional language I have really 'got'. I'm really enjoying the change from C / Java / C++ / Python. It's a bit of an eye opening experience. I might jump into Prolog and (finally, I've been meaning to do it for about 2 years now) sit down and learn Haskell next :).

gnasher729
Nov 17, 2010, 08:12 AM
Does anyone know if there is a C equivalent to Boost Asio at all? By that I mean a cross platform library that allows async network IO using the best method for each platform (kqueue on Mac and FreeBSD and epoll on Linux etc).

I haven't been able to find anything from Googling, does anyone have any suggestions at all?

Why would you want to use a "C equivalent" of this library? If it is available on the Mac, then just use it.

Cromulent
Nov 17, 2010, 08:57 AM
Why would you want to use a "C equivalent" of this library? If it is available on the Mac, then just use it.

Because avoiding C++ is the name of the game. If it truly were the only option available to me then yeah I'd bite the bullet but it is not.