Jump to content
  • Advertisement
Sign in to follow this  
MrMark

Asynchronous Sockets on FreeBSD, supports POSIX AIO

This topic is 3875 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!