473,769 Members | 2,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remoting object lifecicle and threads

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(Disp ose).
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
5 2625
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(Disp ose).
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******@icebe rgwireless.com> wrote in message news:<MP******* *************** **@msnews.micro soft.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(Disp ose).
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
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
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 RemotingService s.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******@icebe rgwireless.com> wrote in message news:<MP******* *************** **@msnews.micro soft.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
I have checked, Mono has no implementation for Remoting so far.

Sunny
Nov 15 '05 #5
I have checked, Mono has no implementation for Remoting so far.

Sunny
Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1302
by: Leo Tohill | last post by:
In our IIS application we have C# "behind code" that calls across remoting to a service. In the service, we keep local storage on the thread. From instrumentation, I now realize that hundreds of threads are seen by the service. I'm quite sure that I never had that many simultaneous requests coming across remoting. IIS isn't running nearly that many threads. How are threads managed by remoting on the server side? I imagine they are...
3
4196
by: Yair | last post by:
Hi, After executing a server-client remoting scheme I wrote, I've noticed a constant memory growth (both at the server, and at the client). Searching through various newsgroups, I've stumbled across various posts, regarding this behaviour. My question is: Is there currently any known bug, regarding Dotnet 1.1, which can lead to such behaviour? We have spent a significant amount of time on the subject, and ruled out the possibility of...
6
2800
by: Catherine Jones | last post by:
Hi all, we need urgent help in a matter. We are trying to pass a COM object from the client to server and are facing some problems in the same. We've our client in C# as well as the Server in C# and we're using remoting for client to server communication.
4
1560
by: John Wood | last post by:
I have a thread safe singleton SAO. When clients invoke a method on the SAO, I want the invocation to run in a new thread in the threadpool, not the thread in which the object was created. Basically each client that has a reference to the SAO should run in a new thread dedicated to that client. Is there any way to do this (ie. remoting configuration) without doing it manually? Thanks.
1
2285
by: Bruce M. Carroll | last post by:
I am doing some work a distributed application, which uses events and remoting to accomplish the signaling between applications. This all works. The problem I have (I think) is that since remoting/events essentially guarantees that you are working in a multi-threaded environment, the developer of the application that consumes these events, if they intend on using these events to update a UI, has to understand delegates and invokes....
9
8675
by: Michael Lindsey | last post by:
I need to write a server app to send images to client GUIs that are outside of the server's domain. The client will have the file system path to the image but can not access the file system. I am trying to decide if I should use remoting vs. writing a server that uses networkstreams. I have read that networkstreams\tcp programming should be faster than remoting and is a better choice for what I am doing but that it is difficult to code.
1
1871
by: Antimon | last post by:
Hi, I have a single threaded server application except for async socket methods. Anyway, i need to host some remote objects but remoting mechanism spawns new threads for remote calls. I don't know about .net threading too much. On the sockets part, i can send a response with a delay, so i can exchange info with main thread using queues, generate a response on main thread and send it. But i need to do something to block client if i try...
1
1890
by: fAnSKyer/C# newbie | last post by:
My remoting object lanched a thread, and in my server program, I created a remoting object, bind it in localhost, initialize it. This works fine. and In server program where I created the remoting object, I can use method to communicate with the object in Thread. However, If I use a client, I can communicate all other stuff except those inside the thread. and I got an exception " Unhandled Exception: System.NullReferenceException:...
4
6650
by: Rich | last post by:
Can anyone suggest a good (current) tutorial on how to do basic remoting with C# (2005 express edition)?
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.