Sign in to follow this  

Asynchronous Sockets on FreeBSD, supports POSIX AIO

This topic is 3598 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to find some information on using Asynchronous Sockets in FreeBSD (a unix style OS, like linux). In winsock it's easy, and google seems to only know about how to do this in winsock, python, or using someones home made socket abstraction layer. I want to learn how to do it myself, at a reasonably low level. It looks like POSIX defines a AIO (Asynchronous IO) standard which FreeBSD implements, and its installed on my system, so I'm guessing this is the way to go. I had a poke at the man page, and unless you already understand how it all works, it's quite useless unfortunately. Just to clarify, Asynchronous Sockets are different to non-blocking sockets; non-blocking sockets poll select(), Asynchronous Sockets send you a message/event when they are done. If anyone has got any information on how to do this in FreeBSD, or any unix style OS I'd be very, very, grateful

Share this post


Link to post
Share on other sites
Quite some time ago I discovered Boost::ASIO. Haven't looked back since, and I get IOCP, epoll or kqueue without any portability problems.

libevent might be other viable option, possibly slightly better, if you don't need Windows support. I believe it's written in C, so you're not encumbered by Boost and C++.

YMMV. For me, portability and support is a considerable factor.

Share this post


Link to post
Share on other sites
Asynchronous Sockets, as defined in WinSock, require a message loop to be running. There is no such thing (in general) on UNIX OS-es. Thus, you can't do Asynchronous Sockets on UNIX.

However, that's just as well -- asynchronous sockets perform poorly, and have lots of implementation gotchas. You're much better off using non-blocking sockets, or sockets with select, or (if your UNIX is modern) aio with signals.

That's what the Forum FAQ says, too.

Share this post


Link to post
Share on other sites

This topic is 3598 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this