[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Connected client List on Server

Carlos E. Hernandez

8/3/2004 3:41:00 AM

Is there a way I can access the connected client on my server. I am creating
a remote game. My clients connects to the server, and register the user. I
want to send events to specific clients, How can I get this list so I can
send request to each client separatly. My first approach was to fire the
event and all the clients to check if the message is to that client and do
whatever it needs to do, but it will be slow because the event will fire on
all clients machine..I also want to know how can I check on the server o
client, if a connection is still active..


Thanks.


5 Answers

Sunny

8/3/2004 2:49:00 PM

0

In article <#uCysuQeEHA.1656@TK2MSFTNGP09.phx.gbl>,
carlos@integrasofthn.com says...
> Is there a way I can access the connected client on my server. I am creating
> a remote game. My clients connects to the server, and register the user. I
> want to send events to specific clients, How can I get this list so I can
> send request to each client separatly. My first approach was to fire the
> event and all the clients to check if the message is to that client and do
> whatever it needs to do, but it will be slow because the event will fire on
> all clients machine..I also want to know how can I check on the server o
> client, if a connection is still active..
>
>
> Thanks.
>
>
>

Implement your own event broadcaster. Look at the link bellow for
example. The second solution does not require a third party pieces, and
I have used it a lot of times. Also, search in this newsgroup for "event
wrapper". Recently I have posted a sample solution how to implement your
classes so, there is no need the server to know about the client code
and v.v.

http://www.genuinechannels.com/Content.aspx?id=27&...

Sunny

Carlos E. Hernandez

8/3/2004 4:46:00 PM

0

Thanks for your help. I have downloded your example, will check it out.
About the last question, is there
a way I can know if a client is connected or if the server connection is
still active. When using remoting, are the client and server connected
always?, or they connect as the calls are made.. Thanks.

"Sunny" <sunny@newsgroups.nospam> wrote in message
news:ONvR7jWeEHA.4068@TK2MSFTNGP11.phx.gbl...
> In article <#uCysuQeEHA.1656@TK2MSFTNGP09.phx.gbl>,
> carlos@integrasofthn.com says...
> > Is there a way I can access the connected client on my server. I am
creating
> > a remote game. My clients connects to the server, and register the user.
I
> > want to send events to specific clients, How can I get this list so I
can
> > send request to each client separatly. My first approach was to fire the
> > event and all the clients to check if the message is to that client and
do
> > whatever it needs to do, but it will be slow because the event will fire
on
> > all clients machine..I also want to know how can I check on the server o
> > client, if a connection is still active..
> >
> >
> > Thanks.
> >
> >
> >
>
> Implement your own event broadcaster. Look at the link bellow for
> example. The second solution does not require a third party pieces, and
> I have used it a lot of times. Also, search in this newsgroup for "event
> wrapper". Recently I have posted a sample solution how to implement your
> classes so, there is no need the server to know about the client code
> and v.v.
>
> http://www.genuinechannels.com/Content.aspx?id=27&...
>
> Sunny


Sunny

8/3/2004 6:53:00 PM

0

Hi,

In article <e3v0alXeEHA.3348@TK2MSFTNGP09.phx.gbl>,
carlos@integrasofthn.com says...
> About the last question, is there
> a way I can know if a client is connected or if the server connection is
> still active. When using remoting, are the client and server connected
> always?, or they connect as the calls are made.. Thanks.

It depends on the channel. If the channel is some custom-made (there are
a lot of examples for channels using MSMQ, or even emails :) ) you may
have, or may not have a permanent connection. The build-in channels
(Http and Tcp) there is permanent connection, but there is no mechanism
with the build-in channels to inform you that the connection is broken
at the moment it breaks.

There are a couple of options:

1. from server side - the lifetime of the object. You can use
ITrackingHandler interface to be notified when the lifetime of an object
expires, so you will know the client no longer use it.
2. start a new thread and in it ping some callback method on the client.
If a ping fails, the client is gone.

3. At client side, just put all your remote invocations in try/catch
block, and examine the reason of the exception. If you detect a network
error, you'll know the connection is gone.

There is a little problem with the last method and the TCP channels. If
the connection brakes, it will hang for a very long time. There is no
way how you specify the network timeout value for TCP channel. Search in
this newsgroup for a post "zombie object". I have post there a solution
for this.

Sunny

Sunny

8/3/2004 7:38:00 PM

0

And, as 1.5 :)

Use client side sponsors. Then the server will ask the client to renew
the lifetime of the object. If the connection fails, client will not
renew the lifetime, the object will die, and using tracker you will know
that the client is gone.

Sunny

Carlos E. Hernandez

8/7/2004 11:04:00 AM

0

I searched and didnt found a post for zombie object, do you have the post??

Thanks for all, its been a great help.

"Sunny" <sunny@newsgroups.nospam> wrote in message
news:ezjgZsYeEHA.3428@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> In article <e3v0alXeEHA.3348@TK2MSFTNGP09.phx.gbl>,
> carlos@integrasofthn.com says...
> > About the last question, is there
> > a way I can know if a client is connected or if the server connection is
> > still active. When using remoting, are the client and server connected
> > always?, or they connect as the calls are made.. Thanks.
>
> It depends on the channel. If the channel is some custom-made (there are
> a lot of examples for channels using MSMQ, or even emails :) ) you may
> have, or may not have a permanent connection. The build-in channels
> (Http and Tcp) there is permanent connection, but there is no mechanism
> with the build-in channels to inform you that the connection is broken
> at the moment it breaks.
>
> There are a couple of options:
>
> 1. from server side - the lifetime of the object. You can use
> ITrackingHandler interface to be notified when the lifetime of an object
> expires, so you will know the client no longer use it.
> 2. start a new thread and in it ping some callback method on the client.
> If a ping fails, the client is gone.
>
> 3. At client side, just put all your remote invocations in try/catch
> block, and examine the reason of the exception. If you detect a network
> error, you'll know the connection is gone.
>
> There is a little problem with the last method and the TCP channels. If
> the connection brakes, it will hang for a very long time. There is no
> way how you specify the network timeout value for TCP channel. Search in
> this newsgroup for a post "zombie object". I have post there a solution
> for this.
>
> Sunny