Re: Architecture advise wanted.
From: William Stacey [MVP] (staceywREMOVE_at_mvps.org)
Date: 08/03/04
- Next message: Tiago Costa: "Re: string error"
- Previous message: Vai2000: "WebService Parameter Size Limit and Impact!"
- In reply to: Frank Rizzo: "Re: Architecture advise wanted."
- Next in thread: Frank Rizzo: "Re: Architecture advise wanted."
- Reply: Frank Rizzo: "Re: Architecture advise wanted."
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 3 Aug 2004 09:35:44 -0400
> Well, the problem is that the application must be doing many things
> (accepting UDP connections from UDP clients, accepting TCP/IP
> connections from other types of clients, pushing the data out to TCP
> clients, etc...) so I can't have stuff waiting around.
That I one reason I suggested the queue. Maybe I should expand (lets talk
udp for now).
1) Create a Listener Object and put Start() and Stop() methods on it. You
can listen to all IPs or selected IPs with multiple Listener Objects. Each
object will Contain its own tread.
2) Create your Server Object. This will read the network objects and
process them. Your main logic.
3) Add a *blocking* output queue. The Listener will output objects into
the queue. The Server Object will read objects from this queue.
4) Both the Listener will block/wait on full queue and Server will block on
empty queue. So no polling involved - very efficient.
5) The Server will make reply object and put into some output queue. Your
Listener could also be your Sender, or you can have another thread/object
for that job. You can share the Socket on different threads as long as one
reads and other writes. So you can have sender thread in your listener or
anothe object.
6) This shared queue works well as you can add Listener objects (say
listening on different IP addresses) sending objects to same output queue.
Your server object will just pick them out of the queue without knowing how
many Listeners are working. You can also "inject" objects into the queue
from out-of-band sources like Mgmt, etc. So it is flexible.
I have done just this in a upd/tcp server I am working on, so know it works
well.
Hope that makes some sense. Please post back if not. Cheers!
--wjs mvp
- Next message: Tiago Costa: "Re: string error"
- Previous message: Vai2000: "WebService Parameter Size Limit and Impact!"
- In reply to: Frank Rizzo: "Re: Architecture advise wanted."
- Next in thread: Frank Rizzo: "Re: Architecture advise wanted."
- Reply: Frank Rizzo: "Re: Architecture advise wanted."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|