[Ace-users] [ace-users] pattern for server manager
Douglas C. Schmidt
schmidt at dre.vanderbilt.edu
Sun Dec 16 15:24:26 CST 2007
To ensure that we have proper version/platform/compiler information,
please make sure you fill out the appropriate problem report form
(PRF), which is in
in older versions of ACE+TAO. Make sure to include this information
when asking any questions about ACE+TAO since otherwise we have to
"guess" what version/platform/compiler/options you've using, which is
very error-prone and slows down our responsiveness. If you don't use
the PRF, therefore, it is less likely that someone from the core
ACE+TAO developer team will be able to answer your question.
Naturally, we encourage and appreciate other members of the ACE+TAO
user community who can respond to questions that they have the answers
>I am trying to build a server manager which will manage its ports, so
>that at any time the server manger could create, enable or disable a
>port or ports. Basically the server should be capable of allowing a
>single client to connect to one of its port, so for example,
>application A wil connect on port 2000
>application B will connect on port 3000
>and so forth, at any time the admin should be able to add a new port
>4000 (or what ever ) and allow another application to connect on it.
>I will like to know what is the most efficient way of building this
>because I am just a starter with ACE and might end up using the wrong
>pattern/s, any how what I tried now, is by using the reactor pattern
>and I ran into problems with regard to dynamically adding ports
>(probably because I used the object in the wrong way), I would like to
>know if the reactor is already a singleton or if i would have to take
>any special measures to make it explictly a singleton?
You can use it either as a singleton (e.g., via
ACE_Reactor::instance()) or you can define separate instances of the
ACE_Reactor. Please see Chapters 3 and 4 of C++NPv2
<www.cs.wustl.edu/~schmidt/ACE/book2/> for more details.
>Should I use some other pattern for this?
You should also consider the use of the Acceptor/Connector pattern and
perhaps various concurrency patterns, such as Leader/Followers or
Half-Sync/Half-Async. These patterns are also covered in C++NPv2.
>What pattern should I use to have seperate threads created for each
>port? Will it be possible to achieve seperate threads for seperate
>ports using the reactor?
Sure - check out C++NPv2 for lots of examples.
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Vanderbilt University WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203 NET: d.schmidt at vanderbilt.edu
More information about the Ace-users