.NET Remoting
.NET Remoting
.NET Remoting
.NET Remoting
.NET Remoting
.NET Remoting .NET Remoting .NET Remoting .NET Remoting .NET Remoting .NET Remoting .NET Remoting .NET Remoting
.NET Remoting .NET Remoting
.NET Remoting
Go Back  Xtreme Visual Basic Talk > > > .NET Remoting


Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2007, 12:59 PM
Azr@el's Avatar
Azr@el Azr@el is offline
Contributor
 
Join Date: Oct 2003
Location: Aachen, Germany
Posts: 407
Default .NET Remoting


Hi forum.

Let's say i have 2 Projects. The first project contains class A, the second contains class B.
how can i now access the instance of Class A over a network using Remoting?

I read the msdn articles on that topic, and somehow the info provided there was incomplete or did not work
Can anyone give me a short introduction into how to use .NET remoting?
__________________
Join #code @ irc://irc.RandomIRC.com
My JabberID: |Azrael|@jabber.ccc.de
Reply With Quote
  #2  
Old 01-12-2007, 03:59 AM
shaul_ahuva.NET Remoting shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

Have you tried searching for a tutorial?
Reply With Quote
  #3  
Old 01-12-2007, 07:34 AM
Azr@el's Avatar
Azr@el Azr@el is offline
Contributor
 
Join Date: Oct 2003
Location: Aachen, Germany
Posts: 407
Default

I tried, but my search didn't return anything valuable

I read some of the articles which google shows. They all show how to access a class over a network connection. But i don't see how to access a special object, i.e. an instance of that class created earlier in the remote program.
Or will i have to mark the remote class as shared?

PS: Is it possible to use interfaces on remoting?
__________________
Join #code @ irc://irc.RandomIRC.com
My JabberID: |Azrael|@jabber.ccc.de

Last edited by Azr@el; 01-12-2007 at 07:43 AM.
Reply With Quote
  #4  
Old 01-12-2007, 09:40 AM
shaul_ahuva.NET Remoting shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

I don't think the remoting infrastructure directly supports retrieving a specific instance of a class - as far as I know it only supports retrieval of new objects created for the client's request. Also, I think once the client releases all references to the remote object it would be collected.

I can think of a couple different solutions to the problem:
  • Use a singleton server-activated object - all clients use one object.
  • Create a class to manage your remotely created objects. For example:
    Code:
    'Server Public Class MyActivator 'Register as singleton Inherits MarshalByRefObject Private _MyRemoteObjects As New ArrayList 'Instead of using New on the client, call this method to get your objects Public Function GetObject(id As Integer) As MyObject 'Find the object in _MyRemoteObjects, or create new if necessary. End Function End Class Public Class MyObject Inherits MarshalByRefObject Public Id As Integer End Class . . . 'Client Dim a As New MyActivator Dim o As MyObject = a.GetObject(1)
  • Customize the server activation process to look up existing objects. I've never tried it (and didn't know about it until I searched), but this reference seems to be a good starting place to figure out how this can be done.

As far as using interfaces, I've never tested it but I would imagine you can only use concrete types since the remoting system would need to create an instance of the type.

Last edited by shaul_ahuva; 01-12-2007 at 09:51 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
.NET Remoting
.NET Remoting
.NET Remoting .NET Remoting
.NET Remoting
.NET Remoting
.NET Remoting .NET Remoting .NET Remoting .NET Remoting .NET Remoting .NET Remoting .NET Remoting
.NET Remoting
.NET Remoting
 
.NET Remoting
.NET Remoting
 
-->