Add-Ons & Services

Question regarding server implementation

Please post support and help requests here.

Question regarding server implementation

Postby metis » 12 Nov 2007, 18:21

Hi, I'm a new user of the poco library (BTW, great job folks), and I have little questions regarding the socket reactor implementation.

My server will be using long lasting connections and many clients will be permanently connected to it. So that's why I want to use the socket reactor since its using a thread for all clients beside a thread per client like the TCPServer implementation (I'm right?).

The catch is that my server needs to dispatch packets to other clients depending of one client's packet. It will have multiple requests processed concurrently. So here's my implementation:

Modified SocketAcceptor that links a reference of the ClientManager with a ClientHandler

In this one, there's a hash containing the clients sockets so I can dispatch the packets to other clients. It has a threadpool, a tasklist and a taskmanager, and launches taskes if threads are available. Its an independant class that is friend with the clienthandler class and it runs in its own thread. A task class (inherited from Poco::Task) calls a function in clientManager to send the data to other clients.

First, if would like to know if this implementation makes sense with the Reactor pattern or my design is bad or how I could design it to get rid of my hash containing sockets (I know I could modify socketreactor.cpp, but I want my implementation to be independent of poco)

Posts: 2
Joined: 22 Oct 2007, 16:21

Re: Question regarding server implementation

Postby metis » 20 Nov 2007, 17:50

Well, it seems that no one will answer... maybe wrong forum?

I think I have some design problems, since when I stress test my implementation, I always get a segfault with concurrent threads. So, a Reactor seems to be a bad idea if we need to forward processed data to other clients.

I am missing something?

PS: The server segfault only if clients are segfaulting (ConnectionResetException)

Posts: 2
Joined: 22 Oct 2007, 16:21

Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest