Add-Ons & Services

SocketReactor w/non-C++ socket-based libraries

Please post support and help requests here.
Posts: 1
Joined: 02 Jul 2012, 16:40

SocketReactor w/non-C++ socket-based libraries

Postby pcaswell » 02 Jul 2012, 16:48

Apologies up front if this is documented somewhere and I haven't tracked it down.

I'm looking for some advice on integrating non-C++ socket based libraries into my Poco application. I have two third party C-based libraries that I need to integrate into my application. For either of them, I call an initialization function which returns a socket file descriptor. I can then use the fd with select() (or poll()). When the select lights up, the library provides me with a function to call to process data from the socket.

Would you'all recommend that I wrap the library into a SocketImpl class and use the SocketReactor to dispatch the events? That seems like the right thing to do, but it doesn't quite seem to fit.

Can someone point to some example code for someone doing something like this?


Posts: 1200
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: SocketReactor w/non-C++ socket-based libraries

Postby alex » 03 Jul 2012, 18:06

I looked at the code and it seems that what you are trying to do cannot be accomplished without intervention into the framework.

The only socket implementations that can be constructed from fd (i.e. have public constructor taking fd as an argument) are StreamSocketImpl and DatagramSocketImpl.
On the reactor side, SocketAcceptor wants ServerSocket, which has a SocketImpl* constructor but it's protected (although I don't see a reason for this constructor because the class has no friends).

Return to “Support”

Who is online

Users browsing this forum: No registered users and 6 guests