Wrapping parts of boost::asio in a C library - for use on embedded Linux
I'm looking for a good ( and simple ) sockets library that I can incorporate into an XMPP client I am building in C for embedded Linux.
Lots of people have recommended boost::asio, and since I am already familiar with C++ and some aspects of boost - I thought I might wrap this up into a C library to be called from my code.
How difficult to people think this might be as opposed to using another sockets library - am I just overcomplicating things?
I have开发者_运维问答 looked at Simple Sockets Library (written in C) but I find it a bit tricky for asynchronous messages.
Further clarification on the interface I need to support (to answer comment below): connect(ip, port)
close()
getIncomingMessage()
I also need some way of being notified when something has been sent down the wire - polling would be too intensive as this is for a connection that only gets data sent down it periodically and is ideally open for a long time ( until someone turns off the device ).
Using Boost ASIO to implement a C interface does sound a bit complicated and mismatched. How about starting with something more native to C, like libevent? I know it's not the same, but it's a start, and socket programming is well supported in C itself.
精彩评论