all groups > dotnet myservices > october 2004 >
You're in the

dotnet myservices

group:

Clients "aware" of one another


Clients "aware" of one another Curtis Justus
10/7/2004 12:15:18 AM
dotnet myservices:
Hi,

I am writing a client/server application where I want my clients to be able
to receive messages from other clients. Here is an example: each client
has a list of help desk calls open. If an action is taken against one of
those items on one client, it would send a message to the other clients that
an action has been taken. The clients would take some type of action based
on that message.

I tried to set up a static delegate that would sit within my service. My
clients would attach an event handler via remoting. Clients would send a
message via a remoted object, and the clients would receive one or two
messages, but would then lose the connection to the delegate.

Does anybody have any ideas of other ways I could handle this? I thought of
maybe having a static message queue in my service and my clients could push
items onto that queue. The clients could poll the service every X seconds
to see if there are any updates, but that seems inefficient. Is there a
good way of having the server alert the client when a new message has been
sent from another client? Perhaps I should have a separate messaging
service that only handles messaging requests...

Thanks in advance,
cj

Re: Clients "aware" of one another Ken Kolda
10/7/2004 8:21:13 AM
I think you were on the right track with the delegate/event model. There are
many examples of this type of architecture on the web -- here's one along
with an article that explains some of the issues with events in a remoting
environment:

Remoting Events Sample
http://staff.develop.com/woodring/dotnet/#RemoteEvents

Working With Events Over Remoting:
http://www.dotnetjunkies.com/Tutorial/BFB598D4-0CC8-4392-893D-30252E2B3283.dcik

Good luck -
Ken


[quoted text, click to view]

Re: Clients "aware" of one another Curtis Justus
10/7/2004 10:22:24 PM
Ken,

Thanks for the links.

Take care,
cj
[quoted text, click to view]

Re: Clients "aware" of one another Jay B. Harlow [MVP - Outlook]
10/8/2004 9:41:33 AM
Curtis,
Matthew MacDonald's book "Microsoft Visual Basic .NET Programmer's Cookbook"
from MS Press has a topic that shows how to create a simply chat like client
using remoting.

He creates a server side Singleton that maintains the list of clients, when
a client asks the server to broadcast a message, the server iterates the
list of clients, calling a method.

Both the server & client are remotable objects, the server object exists on
the server, while the client objects exist on the clients.

Hope this helps
Jay


[quoted text, click to view]

AddThis Social Bookmark Button