473,508 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problems about remoting singleton

we know that if the type is registered as singleton in the host side, then
all the remoting clients share one object, like:
host:
=====
TcpServerChannel chn = new TcpServerChannel(9999);
ChannelServices.RegisterChannel(chn,true);

RemotingConfiguration.RegisterWellKnownServiceType (typeof(SomeClass),
"someclass",WellKnownObjectMode.SingleCall);
========

client:
===========
SomeClass a = (SomeClass)Activator.GetObject(typeof(SomeClass),
@"tcp://172.16.64.190:9999/mul");
===========

now that all the remoting clients share one object, is there anyway i can
capture this object shared by the client? or can i just "new" an object and
then register this very object instead of the type of it on the host side so
i can control the state and behavior of it.

thankx
Dec 22 '06 #1
3 4932
Not entirely sure about the answer to your question (although I will look),
however, the line:
RemotingConfiguration.RegisterWellKnownServiceType (typeof(SomeClass),
"someclass",WellKnownObjectMode.SingleCall);
doesnt make a singleton. The WellKnownObjectMode.SingleCall means one per
client. WellKnownObjectMode.Singleton means one shared object
--
Ciaran O''''Donnell
http://wannabedeveloper.spaces.live.com
"fairyvoice" wrote:
we know that if the type is registered as singleton in the host side, then
all the remoting clients share one object, like:
host:
=====
TcpServerChannel chn = new TcpServerChannel(9999);
ChannelServices.RegisterChannel(chn,true);

RemotingConfiguration.RegisterWellKnownServiceType (typeof(SomeClass),
"someclass",WellKnownObjectMode.SingleCall);
========

client:
===========
SomeClass a = (SomeClass)Activator.GetObject(typeof(SomeClass),
@"tcp://172.16.64.190:9999/mul");
===========

now that all the remoting clients share one object, is there anyway i can
capture this object shared by the client? or can i just "new" an object and
then register this very object instead of the type of it on the host side so
i can control the state and behavior of it.

thankx
Dec 22 '06 #2
I cant see anything from the framework to do this but one easy answer is to
have a static property on the server type which each instance sets to itself
on activation. For a singleton, there should only be one so it should work
nicely. Then you can access this property on the server. You will need to
ensure thread safety on all methods and properties though.
--
Ciaran O''''Donnell
http://wannabedeveloper.spaces.live.com
"fairyvoice" wrote:
we know that if the type is registered as singleton in the host side, then
all the remoting clients share one object, like:
host:
=====
TcpServerChannel chn = new TcpServerChannel(9999);
ChannelServices.RegisterChannel(chn,true);

RemotingConfiguration.RegisterWellKnownServiceType (typeof(SomeClass),
"someclass",WellKnownObjectMode.SingleCall);
========

client:
===========
SomeClass a = (SomeClass)Activator.GetObject(typeof(SomeClass),
@"tcp://172.16.64.190:9999/mul");
===========

now that all the remoting clients share one object, is there anyway i can
capture this object shared by the client? or can i just "new" an object and
then register this very object instead of the type of it on the host side so
i can control the state and behavior of it.

thankx
Dec 22 '06 #3
1.do you mean that i design the server type as a singleton (using the
singleton pattern as showned in the book of GOF)?
2.it is really my stupid mistake the the codes given previous, i actually
meant WellKnownObjectMode.Singleton
Dec 23 '06 #4

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

Similar topics

2
7266
by: Fadi | last post by:
Backround: I am trying to figure out how to do the equivalant of a classic COM Local Server Singleton in .NET/C#. I created a coupld of simple Class Libs that exposes public interfaces and hosted...
9
2088
by: Nak | last post by:
Hi there, I have been messing around with remoting in an attempt to create a "shared application" as mentioned in another thread by that name. I have created a singleton object just like the...
6
1609
by: AMDRIT | last post by:
Hello folks, I appologize for the cross post, but I really need an answer on this: I do not think that I am seeing the whole picture here. I would like to create a windows service and a...
1
12189
by: james.cssa | last post by:
When I try to compile the following program on Visual Studio 2005 Pro, the namespace System.Runtime.Remoting.Channels.Tcp is not recongized by the compiler. (The "Tcp" part is highlighted.) And I...
5
3858
by: mitch | last post by:
Hello, Basically, I want my application to run only one instance at a time and pass command line arguments to a running instance. I have all of this working, I used the IPC Remoting channel and...
6
2071
by: Palvinder Singh | last post by:
Hello google group peeps, I am new to remoting, but have a grasp of it. I am trying to create a server/client application, which will be deployed over an intranet. I have upwards of five...
4
6620
by: Rich | last post by:
Can anyone suggest a good (current) tutorial on how to do basic remoting with C# (2005 express edition)?
13
1863
by: José Joye | last post by:
Hello, What is the best way to stop a remoting server (Singleton SAO) that has been started with RemotingConfiguration.Configure(). For sure, I want to do this without quitting the application...
2
3041
by: erbilkonuk | last post by:
Hi, I am very new to .NET Remoting and I try to run a simple program to subscribe to an event raised by Remoting Class. The Remoting Server initiates an instance of Remoting Class as Singleton /...
0
7227
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7391
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...
1
7054
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...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5633
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,...
1
5056
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...
0
4713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1564
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.