By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,458 Members | 1,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,458 IT Pros & Developers. It's quick & easy.

Remoting object lifecicle and threads

P: n/a
Hi,
I have to implement client/server application. The client have to
instaniate an remoting object via http and pass some auth info. If the
auth is OK, the client should invoke a method (or sequence of methods)
which will do the actual work (prepare a binary file) and return it to
the client.
It seems (after all the reading) that in order to prevent passing the
auth info every method call, I have to implement Client activated
object, and to make the client independent, I have to use Interface
approach.
So now I have a couple of questions, for which I couldn't find clear
answers so far.
I'd appreciate every single answer on any of the questions.

The developing environment is VS.Net 2003, framework 1.1, language C#.
Server - 2K or 2003.

The questions are:

0. I have read somewhere (I can not find it again) that using the
Interface approach is not recommended. Is there something true? Why?
Alternatives?
1. Is it possible to use https (SSL) instead plain http and how to
implement it (I'd like to use a custom port also).
2. Are events possible thru http request? Or do I have to open
additional channel for events? I'd like server to notify client for the
actions taken so far.
3. When server creates a new instance for connected clients, are these
instances created in different threads (I.e. do the methods for every
client run independently).
4. Because a large amount of unmanaged resources will be created for
every client (approx. 300-500K), how do I control the lifecicle of the
object, so I can be sure that they are released if something happens
(like broken connection)?
5. Can I return a stream (or BinaryStream) property to the client, so I
can track the process of transferring the file from server to client? Or
any other suggestion how to track the transfer?
6. May I control somehow the number of connected clients (in order to
prevent overloading of the server)? I have found a good link in the
csharp newsgroup for semaphores, so I'm wondering if it will work for
that purpose, because it seems that if I go that way, I have to trigger
the semaphore in constructor and destructor(Dispose).
7. Do I have to include the Dispose method in the interface, or I have
to implement it only in the server implementation of the object?
8. Is there a way explicitly to invoke the end of life of the object
from the client?
Thanks a lot for reading all this.
Sunny
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Sunny,
0. I have read somewhere (I can not find it again) that using the
Interface approach is not recommended. Is there something true? Why?
Alternatives?
Why don't use interface approach? I highly recommend it's using:
http://www.genuinechannels.com/Conte...x?id=28&type=1
1. Is it possible to use https (SSL) instead plain http and how to
implement it (I'd like to use a custom port also).
Sure, just specify https-based url.
2. Are events possible thru http request? Or do I have to open
additional channel for events? I'd like server to notify client for the
actions taken so far.
Everything is possible. You can find several approaches here:
http://www.genuinechannels.com/Conte...x?id=27&type=1
3. When server creates a new instance for connected clients, are these
instances created in different threads (I.e. do the methods for every
client run independently).
Instances are created in the memory, not threads. If you mean invocation,
then yes, all the invocations performed in separate Threads taken from
ThreadPool.
4. Because a large amount of unmanaged resources will be created for
every client (approx. 300-500K), how do I control the lifecicle of the
object, so I can be sure that they are released if something happens
(like broken connection)?
See lease and lifetime managements. At Ingo Rammer's site
(www.dotnetremoting.cc) and in MSDN.
5. Can I return a stream (or BinaryStream) property to the client, so I
can track the process of transferring the file from server to client? Or
any other suggestion how to track the transfer?
If you will use a stream, you'll double the traffic. See deailes here:
http://www.genuinechannels.com/Conte...x?id=23&type=1
6. May I control somehow the number of connected clients (in order to
prevent overloading of the server)?
Sorry for direct advertisment, :-) here:
http://www.genuinechannels.com/Conte...type=1#reason7
I have found a good link in the
csharp newsgroup for semaphores, so I'm wondering if it will work for
that purpose, because it seems that if I go that way, I have to trigger
the semaphore in constructor and destructor(Dispose).
Do you really want to waste your time on it?
7. Do I have to include the Dispose method in the interface, or I have
to implement it only in the server implementation of the object?
You do not need to include Dispose method in the INTERFACE. That's for sure.
8. Is there a way explicitly to invoke the end of life of the object
from the client?
Just remove a sponsor.

Buy the way, you asked pretty good questions! What application you're going
to develop?

--- www.genuinechannels.com
Regards,
Dmitry.
Sunny <su******@icebergwireless.com> wrote in message news:<MP************************@msnews.microsoft. com>... Hi,
I have to implement client/server application. The client have to
instaniate an remoting object via http and pass some auth info. If the
auth is OK, the client should invoke a method (or sequence of methods)
which will do the actual work (prepare a binary file) and return it to
the client.
It seems (after all the reading) that in order to prevent passing the
auth info every method call, I have to implement Client activated
object, and to make the client independent, I have to use Interface
approach.
So now I have a couple of questions, for which I couldn't find clear
answers so far.
I'd appreciate every single answer on any of the questions.

The developing environment is VS.Net 2003, framework 1.1, language C#.
Server - 2K or 2003.

The questions are:

0. I have read somewhere (I can not find it again) that using the
Interface approach is not recommended. Is there something true? Why?
Alternatives?
1. Is it possible to use https (SSL) instead plain http and how to
implement it (I'd like to use a custom port also).
2. Are events possible thru http request? Or do I have to open
additional channel for events? I'd like server to notify client for the
actions taken so far.
3. When server creates a new instance for connected clients, are these
instances created in different threads (I.e. do the methods for every
client run independently).
4. Because a large amount of unmanaged resources will be created for
every client (approx. 300-500K), how do I control the lifecicle of the
object, so I can be sure that they are released if something happens
(like broken connection)?
5. Can I return a stream (or BinaryStream) property to the client, so I
can track the process of transferring the file from server to client? Or
any other suggestion how to track the transfer?
6. May I control somehow the number of connected clients (in order to
prevent overloading of the server)? I have found a good link in the
csharp newsgroup for semaphores, so I'm wondering if it will work for
that purpose, because it seems that if I go that way, I have to trigger
the semaphore in constructor and destructor(Dispose).
7. Do I have to include the Dispose method in the interface, or I have
to implement it only in the server implementation of the object?
8. Is there a way explicitly to invoke the end of life of the object
from the client?
Thanks a lot for reading all this.
Sunny

Nov 15 '05 #2

P: n/a
Hi Dmitry,
thank you very much for the help. I have some additional questions,
based on your answers. I'll put them inline. I really appreciate your
help.
1. Is it possible to use https (SSL) instead plain http and how to
implement it (I'd like to use a custom port also).
Sure, just specify https-based url.

This is in case if I host the remote object in IIS. It is a solution for
now, but there are some ideas to migrate to Linux/Mono, so I'm not sure
now that object will be hosted in IIS in near future.
2. Are events possible thru http request? Or do I have to open
additional channel for events? I'd like server to notify client for the
actions taken so far.


Everything is possible. You can find several approaches here:
http://www.genuinechannels.com/Conte...x?id=27&type=1

I have not read the article yes, but I have to ask :): what about
exceptions? I.e. if server code throws custom exception, can I catch in
try/catch on the client? Is the approach same, as events?
5. Can I return a stream (or BinaryStream) property to the client, so I
can track the process of transferring the file from server to client? Or
any other suggestion how to track the transfer?


If you will use a stream, you'll double the traffic. See deailes here:
http://www.genuinechannels.com/Conte...x?id=23&type=1

Ok, how then to keep track of the download so far, I.e. in order to
display a progress bar on client?
7. Do I have to include the Dispose method in the interface, or I have
to implement it only in the server implementation of the object?


You do not need to include Dispose method in the INTERFACE. That's for sure.
8. Is there a way explicitly to invoke the end of life of the object
from the client?


Just remove a sponsor.

7-8. Remove sponsor where (client or server). I.e. there are 2 possible
scenarios: 1. broken connection - then server have to kill the object
and release resources; 2. end of work - client should notify the server
that everything is ok, and object have to be released.

Buy the way, you asked pretty good questions! What application you're going
to develop?
:) I do not want to lose experts time, so I first read, after that
decide what questions to ask.
About the application - this is Outlook addin, which receives from the
server some data, and adds/modifies it in Outlook. (and assoc.
additional info (this zip file), which can not be placed directly in
Outlook)
--- www.genuinechannels.com
Regards,
Dmitry.


Thanks again
Sunny
Nov 15 '05 #3

P: n/a
Hi Sunny,
1. Is it possible to use https (SSL) instead plain http and how to
implement it (I'd like to use a custom port also).
Sure, just specify https-based url.

This is in case if I host the remote object in IIS. It is a solution for
now, but there are some ideas to migrate to Linux/Mono, so I'm not sure
now that object will be hosted in IIS in near future.


They should implement SSL layer and make it available transparently
via https protocol. Otherwise you should better use custom encryption
mechanism.
By the way, can you say some words about Linux/Mono? Is it workable
right now? I think, I'll try to port Genuine Channels to Linux/Mono as
well...
2. Are events possible thru http request? Or do I have to open
additional channel for events? I'd like server to notify client for the
actions taken so far.


Everything is possible. You can find several approaches here:
http://www.genuinechannels.com/Conte...x?id=27&type=1

I have not read the article yes, but I have to ask :): what about
exceptions? I.e. if server code throws custom exception, can I catch in
try/catch on the client? Is the approach same, as events?


Sure, you'll receive either a call result or an exception. Take a look
at that article firstly.
5. Can I return a stream (or BinaryStream) property to the client, so I
can track the process of transferring the file from server to client? Or
any other suggestion how to track the transfer?


If you will use a stream, you'll double the traffic. See deailes here:
http://www.genuinechannels.com/Conte...x?id=23&type=1

Ok, how then to keep track of the download so far, I.e. in order to
display a progress bar on client?


There are two approaches to keep track of download progress. Both of
them are explained in that article as well. Just take a look.
8. Is there a way explicitly to invoke the end of life of the object
from the client?


Just remove a sponsor.

7-8. Remove sponsor where (client or server). I.e. there are 2 possible
scenarios: 1. broken connection - then server have to kill the object
and release resources; 2. end of work - client should notify the server
that everything is ok, and object have to be released.

1. broken connection - then server have to kill the object and release resources;

In this case object will be freed automatically after its lease will
be expired.
2. end of work - client should notify the server that everything is ok, and object have to be released.

Either remove a sponsor or try RemotingServices.Disconnect method. I
would prefer just to remove the sponsor, because it's simplier.
Buy the way, you asked pretty good questions! What application you're going
to develop?

:) I do not want to lose experts time, so I first read, after that
decide what questions to ask.
About the application - this is Outlook addin, which receives from the
server some data, and adds/modifies it in Outlook. (and assoc.
additional info (this zip file), which can not be placed directly in
Outlook)


And... You have Outlook running under linux?!

I do not consider myself an expert in .NET Remoting. Just spent more
than a year to understand how it works and just fixed a behavior I
found unacceptable for my client-server solutions.

--- www.genuinechannels.com. The product with the future.
Regards,
Dmitry.
Sunny <su******@icebergwireless.com> wrote in message news:<MP************************@msnews.microsoft. com>... Hi Dmitry,
thank you very much for the help. I have some additional questions,
based on your answers. I'll put them inline. I really appreciate your
help.
1. Is it possible to use https (SSL) instead plain http and how to
implement it (I'd like to use a custom port also).


Sure, just specify https-based url.

This is in case if I host the remote object in IIS. It is a solution for
now, but there are some ideas to migrate to Linux/Mono, so I'm not sure
now that object will be hosted in IIS in near future.
2. Are events possible thru http request? Or do I have to open
additional channel for events? I'd like server to notify client for the
actions taken so far.


Everything is possible. You can find several approaches here:
http://www.genuinechannels.com/Conte...x?id=27&type=1

I have not read the article yes, but I have to ask :): what about
exceptions? I.e. if server code throws custom exception, can I catch in
try/catch on the client? Is the approach same, as events?
5. Can I return a stream (or BinaryStream) property to the client, so I
can track the process of transferring the file from server to client? Or
any other suggestion how to track the transfer?


If you will use a stream, you'll double the traffic. See deailes here:
http://www.genuinechannels.com/Conte...x?id=23&type=1

Ok, how then to keep track of the download so far, I.e. in order to
display a progress bar on client?
7. Do I have to include the Dispose method in the interface, or I have
to implement it only in the server implementation of the object?


You do not need to include Dispose method in the INTERFACE. That's for sure.
8. Is there a way explicitly to invoke the end of life of the object
from the client?


Just remove a sponsor.

7-8. Remove sponsor where (client or server). I.e. there are 2 possible
scenarios: 1. broken connection - then server have to kill the object
and release resources; 2. end of work - client should notify the server
that everything is ok, and object have to be released.

Buy the way, you asked pretty good questions! What application you're going
to develop?

:) I do not want to lose experts time, so I first read, after that
decide what questions to ask.
About the application - this is Outlook addin, which receives from the
server some data, and adds/modifies it in Outlook. (and assoc.
additional info (this zip file), which can not be placed directly in
Outlook)
--- www.genuinechannels.com
Regards,
Dmitry.


Thanks again
Sunny

Nov 15 '05 #4

P: n/a
I have checked, Mono has no implementation for Remoting so far.

Sunny
Nov 15 '05 #5

P: n/a
I have checked, Mono has no implementation for Remoting so far.

Sunny
Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.