473,395 Members | 2,079 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,395 software developers and data experts.

Reference going missing in Remoted Object

I have a remotable object running in my host application.

The host starts up and creates the object. Within a method to start the
remote object doing its thing it creates an object.

This object reference is passed into another object create within the same
method.

A sample of remote object goes something like this:

Public Sub Start()

_microListener = New TcpClient

_microHub = MicroControllerHub.GetInstance()

_microHub.SetTcpClient(TcpClient)

End Sub

The microListener is passed into the _microHub (which is a Singleton)

The microListener object seems to be alive in the calling object but for
some reason the reference is lost

In the _microHub object.

Any remoting experts out there who can help?
Jul 21 '05 #1
7 1897
Hi Nick

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
Slight error in example:

_microHub.SetTcpClient(TcpClient)

should read:

_microHub.SetTcpClient(_microListener)

Anyway - I have some further information add. The Host object doesn't seem
to lose the object reference to TcpClient. I know this as the host has
started the object running and send the time out through the socket every 10
seconds.

I have a client application which can obtain a refrence to the _microHub
object and display the contents of it on a form.

However, when the client attempts to call a specific method on this object -
I get the object not there type of error message. This method call utilises
the TcpClient reference - which should be there because the timer code in
the client is using it.

"Nick Zdunic" <ni**@ss.com.au> wrote in message
news:e9******************@news-server.bigpond.net.au...
I have a remotable object running in my host application.

The host starts up and creates the object. Within a method to start the
remote object doing its thing it creates an object.

This object reference is passed into another object create within the same
method.

A sample of remote object goes something like this:

Public Sub Start()

_microListener = New TcpClient

_microHub = MicroControllerHub.GetInstance()

_microHub.SetTcpClient(TcpClient)

End Sub

The microListener is passed into the _microHub (which is a Singleton)

The microListener object seems to be alive in the calling object but for
some reason the reference is lost

In the _microHub object.

Any remoting experts out there who can help?

Jul 21 '05 #3
Hi Nick,

I think to pass an object by reference to an remote instance, we need to
declare the object class inherited from MarshalByRefObject. So that it can
across the AppDomain.
While TCPClient is not inherited from MarshalByRefObject, so it can not
across the appdomain. In remoting programming, the client and the host will
be in two different appdomain.(similar with the process in the traditional
win32 programming).

For your senario, I think you may try to wrap the TCPClient in an
MarshalByRefObject
e.g.
public class MyRemoteObject : MarshalByRefObject
{
public TCPClient tc;
public MyRemoteObject()
{
tc = new TCPClient();
}
}

You may have a try and let me know the result.
Can you tell me why you need to pass an TCPClient by reference to remoting
object?

Best 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.

Jul 21 '05 #4
I don't think that was the problem. Another object (one of mine) which
inherits from MarshalByRefObject has the same problem.

I have made some mods and the problem doen't occur anymore.

The code was working something like this.

- get a reference to remote object called PacketListener - this is running
as a remote object
- call a method called Start on this object
- get a refrence to an object called MicroHub which is created within the
Start method
- Display the contents of MicroHub on a grid using binding - this works fine
- Call Method Send on MicroHub reference. This would fail. Any object
within MicroHub would be set to nothing (not just TcpClient as mentioed
previously)

The change to the code results in a slightly different process:

- get a reference to remote object called PacketListener - this is running
as a remote object
- call a method called Start on this object
- get a refrence to an object called MicroHub which is created within the
Start method
- Display the contents of MicroHub on a grid using binding - this works fine
- Call Send on PacketListener. This method was moved to PacketListener and
uses the reference to MicroHub which is in the PacketListener residing in
the remote host. This works.

It seems that calling methods on the secondary object (MicroHub) would not
work when those methods contain code which reference a module level object
in MicroHub

However going through PacketListener - the object created by the client
through remoting - this works.

HOWEVER

I have another problem. The MicroHub object displays fine in a grid. This
MicroHub object contains a collection of micro instances. MicroHub inherits
from a base object I created called DomainCollectionBase which in turn
inherits from CollectionBase and implements IBindingList. The micro object
inherits from a class called DomainBase which in turn inherits from
MarshalByRefObject and implements IEditableObject.

Now the contents are displayed fine. However retrieving a value from micro
is causing a problem. I use a CurrencyManager to track movement in the
grid. I use this to get the currently selected micro in the collection.
This works - but using a value with micro is not working. An integer
property called ControllerID in this object is always returning zero no
matter which row I select in the grid. My non- remotong version of the
program always returns the right value. Other properties exhibit similar
behaviour.

What could be going wrong?

Nick

""Peter Huang"" <v-******@online.microsoft.com> wrote in message
news:k7**************@cpmsftngxa10.phx.gbl...
Hi Nick,

I think to pass an object by reference to an remote instance, we need to
declare the object class inherited from MarshalByRefObject. So that it can
across the AppDomain.
While TCPClient is not inherited from MarshalByRefObject, so it can not
across the appdomain. In remoting programming, the client and the host
will
be in two different appdomain.(similar with the process in the traditional
win32 programming).

For your senario, I think you may try to wrap the TCPClient in an
MarshalByRefObject
e.g.
public class MyRemoteObject : MarshalByRefObject
{
public TCPClient tc;
public MyRemoteObject()
{
tc = new TCPClient();
}
}

You may have a try and let me know the result.
Can you tell me why you need to pass an TCPClient by reference to remoting
object?

Best 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.

Jul 21 '05 #5
MicroHub is inherited from CollectionBase - does this marshal correctly or
does it implement the same functionality as MarshalByRefObject. It is does
then this probably wont fix the problem.

""Peter Huang"" wrote:
Hi,

I think you may try to make MicroHub inherited from MarshalByRefObject to
see if this works for you.

I think the databindging may not be the root cause of the problem, so far
to isolate the problem, here I have an simple sample, you may have a try
and modify the code according to your idea to reproduce the problem as
simple as possible and send back to me.

Remotable Objects
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconRemotableObjects.asp

Best 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

Jul 21 '05 #6
Peter - I have tried amending the MicroHub to inherit off MarshalByRefObject.

However I think the problem is more related to CollectionBase. I still get
the same problem as the underlying collection in this object is an object of
this type. I think the curencymanager is not being updated with it's current
position. The serialization would appear to work correctly.

""Peter Huang"" wrote:
Hi,

I think you may try to make MicroHub inherited from MarshalByRefObject to
see if this works for you.

I think the databindging may not be the root cause of the problem, so far
to isolate the problem, here I have an simple sample, you may have a try
and modify the code according to your idea to reproduce the problem as
simple as possible and send back to me.

Remotable Objects
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconRemotableObjects.asp

Best 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

Jul 21 '05 #7
Hi,

Thanks for your input.

To isolate the problem and have you tried my sample in my last post.
Also to locate the problem more quickly, I think you may try to wrap the
MicroHubObj in the MicroHub collection as a field or in an arraylist in the
MicroHub to see if the problem persists.

Can you modify the code I provide in my last post and send back to me by
removing "online" from my email address so I can do further troubleshooting.

Best 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.

Jul 21 '05 #8

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

Similar topics

0
by: Tolga Erdogus | last post by:
I am building a thin client winform app which calls data manipulation methods of a web service and the resulting dataset is remoted back to the client. My question is, when I set the datasource...
2
by: Dan | last post by:
I am having a problem trying to assign event handlers to the events of a remoted object. I have one program that registers the object for remoting, Another that connects and calls methods on the...
1
by: Steve Drake | last post by:
All, I have a WEBPAGE that needs to pass the current credentials to a .NET remoted object so this can pass the credentials to a SOAP WEBSERVICE (All written in C#) But I cannot see how I pass...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
7
by: Nick Zdunic | last post by:
I have a remotable object running in my host application. The host starts up and creates the object. Within a method to start the remote object doing its thing it creates an object. ...
3
by: Grant Schenck | last post by:
Hello, I have a Windows Service developed in C# .NET. I'm making it a remote server and I can, via an IPC Channel, expose methods and call them from a client. However, I now want my remoted...
0
by: VishalSimon | last post by:
Remoting Error can not access property or method of proxy object on internet, works fine for LAN Hello, here is my some remoting code Code Snippet Remoted Class: namespace Server
68
by: Jim Langston | last post by:
I remember there was a thread a while back that was talking about using the return value of a function as a reference where I had thought the reference would become invalidated because it was a...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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...
0
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
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...

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.