473,385 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Remoting questions

Nak
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
event is raised each application consuming the singleton recieves the event?
I had troubles trying to implement this.

* Can the host consume the singleton? I didn't seem to be able to
make the host instantiate an instance of the singleton so that it contained
the first and only instance for monitoring purposes etc.

Thanks for your help :-) I'm sure I'm doing something wrong maybe :-\

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #1
9 2076
In article <Oq**************@TK2MSFTNGP12.phx.gbl>, Nak wrote:

First, I want to qualify and say that I'm not a great expert on this
subject.
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
event is raised each application consuming the singleton recieves the event?
I had troubles trying to implement this.

Yes - but you need to be aware of thread blocking issues... There is a
very good book on the subject by Ingo Rammer "Advanced .NET Remoting",
there is both a C# and a VB.NET version of the book. Anyway, you may
want to check out this link for the threading issue:

http://www.ingorammer.com/RemotingFA...PLICATION.html

* Can the host consume the singleton? I didn't seem to be able to
make the host instantiate an instance of the singleton so that it contained
the first and only instance for monitoring purposes etc.


I'm not sure... But, I don't see why not.

HTH
--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #2
Nak
Hi there,
First, I want to qualify and say that I'm not a great expert on this
Fine by me, any advice is greatly appreciated!
Yes - but you need to be aware of thread blocking issues... There is a
very good book on the subject by Ingo Rammer "Advanced .NET Remoting",
there is both a C# and a VB.NET version of the book. Anyway, you may
want to check out this link for the threading issue:

http://www.ingorammer.com/RemotingFA...PLICATION.html

I shall check the link out, thanks loads.
I'm not sure... But, I don't see why not.


Yeah, I thought it might be, I just don't know the correct method for doing
so. Hopefully the above link will shed some light on the subject.

Thanks for your help again :-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #3
Hi Nak,

I am researching the issue, I will update you with new information ASAP.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "Nak" <a@a.com>
References: <Oq**************@TK2MSFTNGP12.phx.gbl> <OU**************@tk2msftngp13.phx.gbl>Subject: Re: Remoting questions
Date: Fri, 17 Oct 2003 19:07:15 +0100
Lines: 33
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <Oa**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: dsl213-218-228-203.as15444.net 213.218.228.203
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:147778
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Hi there,
First, I want to qualify and say that I'm not a great expert on this
Fine by me, any advice is greatly appreciated!
Yes - but you need to be aware of thread blocking issues... There is a
very good book on the subject by Ingo Rammer "Advanced .NET Remoting",
there is both a C# and a VB.NET version of the book. Anyway, you may
want to check out this link for the threading issue:

http://www.ingorammer.com/RemotingFA...PPLICATION.htm

l
I shall check the link out, thanks loads.
I'm not sure... But, I don't see why not.
Yeah, I thought it might be, I just don't know the correct method for doing
so. Hopefully the above link will shed some light on the subject.

Thanks for your help again :-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

\"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ \


Nov 20 '05 #4
Nak
Hi there,
I am researching the issue, I will update you with new information ASAP.


Excellent I shall eagerly await your reply. I'm also out to buy the
advanced .net remoting book to give that a whirl :-) Thanks for your help.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #5
Hi Nick,
* Can the singleton contain events? In such a way that when the
event is raised each application consuming the singleton recieves the event? I had troubles trying to implement this.
Here is a sample about the sink event in remoting object.
Remoting Events
http://staff.develop.com/woodring/dotnet/

* Can the host consume the singleton? I didn't seem to be able to
make the host instantiate an instance of the singleton so that it contained the first and only instance for monitoring purposes etc.

Yes, here I write a simple sample for you.
[Server Host]
Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp
Imports ClassLibrary5
Module Module1
Sub Main()
Dim tcpchannel As New TcpChannel(8082)
ChannelServices.RegisterChannel(tcpchannel)

RemotingConfiguration.RegisterWellKnownServiceType (GetType(HelloServiceClass
), "RemoteTest", WellKnownObjectMode.Singleton)
Dim service As HelloServiceClass =
CType(Activator.GetObject(GetType(HelloServiceClas s),
"tcp://localhost:8082/RemoteTest"), HelloServiceClass)
Console.WriteLine(service.HelloMethod("Server"))
Console.ReadLine()
End Sub
End Module

[Remoting Object]
Imports System
Public Class HelloServiceClass
Inherits MarshalByRefObject
Private str As String
Public Sub New()
Console.WriteLine("Constructor")
End Sub
Public Property ObjFlag()
Get
ObjFlag = str
End Get
Set(ByVal Value)
str = ObjFlag
End Set
End Property
Public Function HelloMethod(ByVal name As String) As String
Return "Hi there " + name + "."
End Function
End Class

[Client]
Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Activation
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp
Imports ClassLibrary5
Module Module1
Sub Main()
ChannelServices.RegisterChannel(New TcpChannel)
Dim sc As ClassLibrary5.HelloServiceClass
sc = CType(Activator.GetObject(GetType(HelloServiceClas s),
"tcp://localhost:8082/RemoteTest"), HelloServiceClass)
Console.WriteLine(sc.HelloMethod("Client"))
End Sub
End Module

From the sample , you will find that he constructor of the remoting object
is called once.
Did I misunderstand your meaning?
If you have any related question, please feel free to let me know.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------From: "Nak" <a@a.com>
References: <Oq**************@TK2MSFTNGP12.phx.gbl> <OU**************@tk2msftngp13.phx.gbl>
<Oa**************@TK2MSFTNGP09.phx.gbl>
<om**************@cpmsftngxa06.phx.gbl>Subject: Re: Remoting questions
Date: Mon, 20 Oct 2003 22:36:49 +0100
Lines: 17
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <Od**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: dsl213-218-228-203.as15444.net 213.218.228.203
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:148492
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Hi there,
I am researching the issue, I will update you with new information ASAP.
Excellent I shall eagerly await your reply. I'm also out to buy the
advanced .net remoting book to give that a whirl :-) Thanks for your help.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

\"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ \


Nov 20 '05 #6
Nak
Hi Peter,
http://staff.develop.com/woodring/dotnet/


Excuse me, but this is very difficult to explain...

I have been looking at the example thoroughly, unfortunately it is in C#, so
I am a little unsure on a few minor details.

Firstly, the events are raised via the eventShim class, unfortunately I
can't for the life of me see 1 solid reference to the eventshim class in the
code!! So I am slightly confused as to how the server could possibly use
the class to forward events when it doesn't even have a reference to or know
about the class.

I would have thought that the server would create a singleton of the
eventshim class and use that to forward to all registered clients, but the
server doesn't even use it! The eventshim class is instantiated on the
client rather than the server.

For example, the server creates a new class, this class is exposed as a
remoting object. The class implements the interface desired for the
remoting object, which in-turn exposes the event. In my code I know that
the server is attempting to raise the event, as I have placed a messagebox
just before the line, but unfortunately the event never gets to the client!!

I suppose my main question should be, where should the eventshim class be
created? Is it simply used on the client side to recieve events? If that
is the case then how does the event even get there if it is not even linked
to the remoteable object? Very confusing example, and seeing as I am using
VB.NET Standard I cannot even see if it works as I would expect. Thanks for
your help again, I think I might scrap that one and read the advanced .net
remoting book.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #7
Hi Nak,

There is a simple VB remoting event sample in .NET SDK.
e.g.
D:\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Samples\Technologies\Remoting\VB
I also has comments in line.

If you have any related question please feel free to let me know.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "Nak" <a@a.com>
References: <Oq**************@TK2MSFTNGP12.phx.gbl> <OU**************@tk2msftngp13.phx.gbl>
<Oa**************@TK2MSFTNGP09.phx.gbl>
<om**************@cpmsftngxa06.phx.gbl>
<Od**************@TK2MSFTNGP12.phx.gbl>
<Lg**************@cpmsftngxa06.phx.gbl>Subject: Re: Remoting questions
Date: Tue, 21 Oct 2003 14:05:09 +0100
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <#X**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: dsl213-218-228-203.as15444.net 213.218.228.203
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:148643
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Hi Peter,
http://staff.develop.com/woodring/dotnet/
Excuse me, but this is very difficult to explain...

I have been looking at the example thoroughly, unfortunately it is in C#,

soI am a little unsure on a few minor details.

Firstly, the events are raised via the eventShim class, unfortunately I
can't for the life of me see 1 solid reference to the eventshim class in thecode!! So I am slightly confused as to how the server could possibly use
the class to forward events when it doesn't even have a reference to or knowabout the class.

EventShim is in the calcif.cs i.e. calcif.dll
You can see the calcif.dll will be referenced in both the server and client.

I would have thought that the server would create a singleton of the
eventshim class and use that to forward to all registered clients, but the
server doesn't even use it! The eventshim class is instantiated on the
client rather than the server.

You may try to see the app.config file of the server.
What the configure file do can also be done in the code.

Remoting Settings Schema
http://msdn.microsoft.com/library/de...us/cpgenref/ht
ml/gnconremotingsettingsschema.asp

<!-- server.exe.config -->
<configuration>
<system.runtime.remoting>
<application name="calcsrv">
<service>
<wellknown mode="Singleton" type="Calc, server" objectUri="calc" />
</service>
<channels>
<channel ref="http" port="999">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/> <!-- On the
1.1 runtime, add typeFilterLevel='Full' to the formatter element -->
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
For example, the server creates a new class, this class is exposed as a
remoting object. The class implements the interface desired for the
remoting object, which in-turn exposes the event. In my code I know that
the server is attempting to raise the event, as I have placed a messagebox
just before the line, but unfortunately the event never gets to the client!! Event is a kind of call back mechanism.
static void Main()
{
RemotingConfiguration.Configure("client.exe.config ");

ICalc c = (ICalc)
RemotingServices.Connect(typeof(ICalc),
ConfigurationSettings.AppSettings["calcURL"]);

MagicNumberCallback cb = EventShim.Create(new
MagicNumberCallback(OnMagicNumber));
c.MagicNumber += cb;//add event handle

Console.WriteLine("c.AppDomainName (Calc) = {0}", c.AppDomainName);
Console.WriteLine("2 + 2 (Calc) = {0}", c.add(2, 2));
//Server fire the MagicNumber event
//Client get the event and fire the event handle function OnMagicNumber

Console.WriteLine("4 + 4 (Calc) = {0}", c.add(4, 4));

c.MagicNumber -= cb;
}
I suppose my main question should be, where should the eventshim class be
created? Server side.
Is it simply used on the client side to recieve events? If that It is an remoting object with event declared.
is the case then how does the event even get there if it is not even linked
to the remoteable object? Very confusing example, and seeing as I am using
VB.NET Standard I cannot even see if it works as I would expect. Thanks foryour help again, I think I might scrap that one and read the advanced .net
remoting book. That is a good book, I think that book will give your many information.

If you have any related question, please feel free to let me know.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ \"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ \


Nov 20 '05 #8
Nak
Hi Peter,
D:\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Samples\Technologies\Remoting\VB
I also has comments in line.


Aaah, I see I have the same for v1.0, I shall check it out, excellent thank
you :-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #9
Hi Nick,

I hope my suggestion can help you.

If you have any related question, please post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "Nak" <a@a.com>
References: <Oq**************@TK2MSFTNGP12.phx.gbl> <OU**************@tk2msftngp13.phx.gbl>
<Oa**************@TK2MSFTNGP09.phx.gbl>
<om**************@cpmsftngxa06.phx.gbl>
<Od**************@TK2MSFTNGP12.phx.gbl>
<Lg**************@cpmsftngxa06.phx.gbl>
<#X**************@TK2MSFTNGP12.phx.gbl>
<LY**************@cpmsftngxa06.phx.gbl>Subject: Re: Remoting questions
Date: Wed, 22 Oct 2003 11:42:22 +0100
Lines: 19
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <ej**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: dsl213-218-227-57.as15444.net 213.218.227.57
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:148990
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Hi Peter,
D:\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Samples\Technologies\Remoting\VB
I also has comments in line.
Aaah, I see I have the same for v1.0, I shall check it out, excellent thank
you :-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

\"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ \


Nov 20 '05 #10

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

Similar topics

2
by: Dicky Cheng | last post by:
Hi, I am using .net remoting technology. I set up a .net remoting client and server in IIS. When the client calls the server, the server will run a long duration method (30-60seconds). I have a...
6
by: Guest | last post by:
Hi, I unerstand that if you choose IIS to host your .Net Remotingcomponents with HTTP channel and SOAP formatter, you get thebuilt-in security and configuraion features of IIS. Also we canexpose it...
4
by: Uchiha Jax | last post by:
Hello everyone, I am a plenty silly person who is trying to learn .NET remoting through trial and error (all articles I read are going over my head at the moment (mostly) so I thought i'd give...
1
by: miha.valencic | last post by:
Hi! What are the options for securing remote objects, which are accessible through IIS, when you have an application deployed on the same server, which uses custom Forms authentication? ...
6
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...
2
by: Ryan | last post by:
My apologies if this is not the forum to post questions regarding .NET Remoting, but I figured WebServices would be the most appropriate forum of the bunch. We're currently completely re-arching...
6
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...
7
by: hardieca | last post by:
Hi, Can anyone point me in the right direction for an example on how to use remoting to separate my BLL and DAL onto different tiers? Is there a best-practice pattern or design model for this? ...
2
by: Wimpie van Lingen | last post by:
Hey I have some more questions with regards to Remoting in .NET 2. I'm using TCP with the Binary formatter. My solution consists of 4 projects: - Class Library containing the server classes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...

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.