Overview
Features
Download
Documentation
Community
Add-Ons & Services

Which set of classes should I use for my app?

Please post support and help requests here.

Which set of classes should I use for my app?

Postby Sylva1n » 13 Dec 2012, 00:23

Hello,

I have just discovered the POCO world and I'm a bit lost.

I plan to code an app which has to:
  • be launched as a deamon
  • launch several threads

  • Two of those threads listens to a port through a socket (TCP).
  • Another thread has to send multicast datagrams (UDP).
  • The last two threads have to run processes (like grep or wget) and retrieve the processes output.
  • The main thread should safely communicate with those threads and vice-versa

Between ServerApplication, SocketReactor and SocketNotification (cf. EchoServer.cpp example), NotificationQueue (cf. NotificationQueue.cpp example) and TaskManager (cf. SampleServer.cpp example), I don't know which design to choose according to my app functionalities.

May you give me some advice?

best regards,

Sylvain
Sylva1n
 
Posts: 4
Joined: 12 Dec 2012, 23:56

Re: Which set of classes should I use for my app?

Postby alex » 13 Dec 2012, 01:25

Sylva1n wrote:[*]be launched as a deamon

Poco::Util::ServerApllication
Sylva1n wrote:launch several threads

Poco::Thread (maybe also Poco::ThreadPool)
Sylva1n wrote:Two of those threads listens to a port through a socket (TCP).

Poco::Net::ServerSocket
EDIT: you may also consider Poco::Net::TCPServer, which is already threaded and uses ThreadPool.
Sylva1n wrote:Another thread has to send multicast datagrams (UDP).

Poco::Net::DatagramSocket
Sylva1n wrote:The last two threads have to run processes (like grep or wget) and retrieve the processes output.

Poco::Process
Sylva1n wrote:The main thread should safely communicate with those threads and vice-versa

Poco::NotificationQueue
Sylva1n wrote:Between ServerApplication, SocketReactor and SocketNotification (cf. EchoServer.cpp example), NotificationQueue (cf. NotificationQueue.cpp example) and TaskManager (cf. SampleServer.cpp example), I don't know which design to choose according to my app functionalities.

Reactor is basically a select() (or poll()/epoll(), where available) loop with notifications, so anything related to sockets above can be done with Reactor, it's just a different model from threads plus blocking .

HTH

Alex
alex
 
Posts: 1143
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron