bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

client/server application setup question


From: Jochen Küpper
Subject: client/server application setup question
Date: Thu, 04 Sep 2003 18:16:46 +0200
User-agent: Gnus v5.10.3

Dear All,

I am trying to write a client--server data acquisition application,
where client and server need not to be running on the same host. The
server is planned to be multithreaded, the client might (or might not)
become mt at some point.

I would like to use the Common C++ abstractions for sockets, threads,
and such and I have looked through and modified some of the examples.
Nevertheless I am not sure where to look for information. (I know the
demos, the introduction, and the doxygen generated docs.)

I would like to have a server that listens on a fixed port (let's say
4000) for connections. On an incoming connection it will read the data
send, which is only a few bytes to determine which handler [1] of the
server is necessary. It determines an unused port (let's say 4003),
starts an appropriate (detached) thread listening on that port, sends
the port number back to the client, and goes back to listen on the
original port (4000).

At the same time the newly created server-thread listens on port 4003
for more data and then reacts accordingly. At some point the client
tells the server-thread that is done and the server-thread will shut
itself down.

Obviously the server has to keep listening on the original port
"forever" and acts as kind of a thread-starter. The multiple (many)
such "secondary" threads should run (quasi-)parallel and will listen
on different ports at the same time.

Looking through the examples it seemed to me that tcpthread.cpp is a
good start and so I went ahead from there. Nevertheless I don't seem
to get it working correctly. I use TCPSession derived classes for the
server threads, but it seems that different threads or sockets are
blocking each other.[2]

I would appreciate any feedback on my ideas, suggestions for
improvements, or simply pointers to additional information or better
places to ask.

Thank you all in advance.

Greetings,
Jochen

Footnotes: 
[1]  A handler could be a device driver, a "database server", or any
     other entity that can be controlled or from which data can be
     requested. Each "backend" should have it's own thread running in
     the server.
[2]  I will post code as soon as it is simple enough and I have at
     least a idea of what is exactly going wrong.
-- 
Einigkeit und Recht und Freiheit                http://www.Jochen-Kuepper.de
    Liberté, Égalité, Fraternité                GnuPG key: CC1B0B4D
        Sex, drugs and rock-n-roll






reply via email to

[Prev in Thread] Current Thread [Next in Thread]