Re: Architecture advise wanted.

From: Frank Rizzo (none_at_none.com)
Date: 08/03/04


Date: Tue, 03 Aug 2004 10:07:28 -0700

William Stacey [MVP] wrote:

>>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
>
>
The design makes sense, but I am not understanding how the listener will
let the Server object know that a new message has arrived.
I am assuming that in the Listener you do the following after you have
received the message.

SyncLock
    cQueue.Add NewMessage
End SyncLock

But how does the Server object know that something has been added to the
queue?

Thanks
But



Relevant Pages

  • Re: Architecture advise wanted.
    ... > connections from other types of clients, pushing the data out to TCP ... That I one reason I suggested the queue. ... Create a Listener Object and put Startand Stopmethods on it. ... The Server Object will read objects from this queue. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Using .Net Remoting for messaging, Help Needed
    ... the server puts its messages to them. ... i need to handle messages and transfer them to the relevant clients, ... i implemented a Listener for MSMQ, the problem is that it has a ... the messages in the Queue, not talking about what if message is ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Deallocating records with task type fields.
    ... In fact the real environment record also has a protected output queue ... passing it to the Listener with a discriminant. ... Listener to arrange for its own deallocation. ...
    (comp.lang.ada)
  • Re: Deallocating records with task type fields.
    ... In fact the real environment record also has a protected output queue ... passing it to the Listener with a discriminant. ... Listener to arrange for its own deallocation. ...
    (comp.lang.ada)
  • Re: Architecture advise wanted.
    ... Your listener will put the packet ... Your Consumer will wait until the ... queue has an object and then go. ... Create a listener thread that listens for udp on port n. ...
    (microsoft.public.dotnet.languages.csharp)

Loading