473,989 Members | 36,371 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:
=====
TcpServerChanne l chn = new TcpServerChanne l(9999);
ChannelServices .RegisterChanne l(chn,true);

RemotingConfigu ration.Register WellKnownServic eType(typeof(So meClass),
"someclass",Wel lKnownObjectMod e.SingleCall);
========

client:
===========
SomeClass a = (SomeClass)Acti vator.GetObject (typeof(SomeCla ss),
@"tcp://172.16.64.190:9 999/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 4957
Not entirely sure about the answer to your question (although I will look),
however, the line:
RemotingConfigu ration.Register WellKnownServic eType(typeof(So meClass),
"someclass",Wel lKnownObjectMod e.SingleCall);
doesnt make a singleton. The WellKnownObject Mode.SingleCall means one per
client. WellKnownObject Mode.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:
=====
TcpServerChanne l chn = new TcpServerChanne l(9999);
ChannelServices .RegisterChanne l(chn,true);

RemotingConfigu ration.Register WellKnownServic eType(typeof(So meClass),
"someclass",Wel lKnownObjectMod e.SingleCall);
========

client:
===========
SomeClass a = (SomeClass)Acti vator.GetObject (typeof(SomeCla ss),
@"tcp://172.16.64.190:9 999/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:
=====
TcpServerChanne l chn = new TcpServerChanne l(9999);
ChannelServices .RegisterChanne l(chn,true);

RemotingConfigu ration.Register WellKnownServic eType(typeof(So meClass),
"someclass",Wel lKnownObjectMod e.SingleCall);
========

client:
===========
SomeClass a = (SomeClass)Acti vator.GetObject (typeof(SomeCla ss),
@"tcp://172.16.64.190:9 999/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 WellKnownObject Mode.Singleton
Dec 23 '06 #4

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

Similar topics

2
7288
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 them in a Windows Forms EXE. Create a Windows Forms client and both the Client and the Host EXEs configure the remoting protocols through respective .config files. Problem: I want to change the host from an Win Forms EXE to a Windows Service.
9
2108
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 example in the 101 VB.NET examples. It works great, only 1 instance ever gets created and is shared by each client. I have a few questions though, * Can the singleton contain events? In such a way that when the
6
1636
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 management console, using Visual Basic 2003. The windows service part, I think, is easy enough. I am more concerned with the remoting aspect of the project. Below is the general idea of my approach, please correct my where I am wrong.
1
12248
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 get the error message: Error 1 The type or namespace name 'Tcp' does not exist in the namespace 'System.Runtime.Remoting.Channels' (are you missing an assembly reference?) C:\Documents and Settings\james\My Documents\Visual Studio...
5
3881
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 my program handles the command line arguments well. However, after my program has been running for a little while (say 5-10 minutes) the command line arguments no longer are passed, and instead it causes a .NET Remoting exception claiming to have...
6
2095
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 clients that connect to a main server. The client application sets the state of several switchs (on/off by means of clicking a button). When a switch is turned on/off, its state is updated on the server, which will then raise an event to update...
4
6661
by: Rich | last post by:
Can anyone suggest a good (current) tutorial on how to do basic remoting with C# (2005 express edition)?
13
1929
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 :-) In fact, at a given time based on an internal event, I would like to stop the remoting functionality within my process. Many thanks,
2
3069
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 / Server activated mode on startup. The Remoting Client accesses the Remoting Class through the interface of the Class and subscribes to an event of the Remoting Class that will be fired upon the private member value change.
0
10406
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10228
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
11923
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
11491
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...
0
10990
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7697
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6501
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...
1
5245
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 we have to send another system
2
4827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.