Access to remote object from server

D

dange

Hi

I want to access a remote object to raise an event. How do I get the
reference to the object from the server application?
I tried to use a singleton but this does not work.

thanks
Dan
 
M

Michel Posseth [MCP]

I tried to use a singleton but this does not work.

Guessing...that you know how remoting works ?

You should use a singleton with a lease timeout set to infinite otherwise ,
it will still create new instances

copy and paste this region in your singleton
#Region " Remoting Override "
''' -----------------------------------------------------------------------------
''' <summary>
''' this method will make sure that the leasetime will be infinite
''' </summary>
''' <returns>Nothing as valid lease point expiration time </returns>
''' <remarks>
''' </remarks>
''' <history>
''' [michel] 6/4/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Overrides Function InitializeLifetimeService() As Object
Return Nothing
End Function
#End Region

hth

michel
 
D

dange

Hi Michel

As this is my first project with remoting I started with downloading an
example that shows the basic event usage with a chat application. This
example already contains your code region.
Raising the event from within the remote object works fine, but from another
server class is not working

Dan

Michel Posseth said:
I tried to use a singleton but this does not work.

Guessing...that you know how remoting works ?

You should use a singleton with a lease timeout set to infinite otherwise ,
it will still create new instances

copy and paste this region in your singleton
#Region " Remoting Override "
''' -----------------------------------------------------------------------------
''' <summary>
''' this method will make sure that the leasetime will be infinite
''' </summary>
''' <returns>Nothing as valid lease point expiration time </returns>
''' <remarks>
''' </remarks>
''' <history>
''' [michel] 6/4/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Overrides Function InitializeLifetimeService() As Object
Return Nothing
End Function
#End Region

hth

michel




dange said:
Hi

I want to access a remote object to raise an event. How do I get the
reference to the object from the server application?
I tried to use a singleton but this does not work.

thanks
Dan
 
M

Michel Posseth [MCP]

Well in that case it should be pretty simple
you can just create a sub in your interface and thus raise the event from
the sub from anny client atached to the singleton

hth

Michel




dange said:
Hi Michel

As this is my first project with remoting I started with downloading an
example that shows the basic event usage with a chat application. This
example already contains your code region.
Raising the event from within the remote object works fine, but from
another
server class is not working

Dan

Michel Posseth said:
I tried to use a singleton but this does not work.

Guessing...that you know how remoting works ?

You should use a singleton with a lease timeout set to infinite
otherwise ,
it will still create new instances

copy and paste this region in your singleton
#Region " Remoting Override "
''' -----------------------------------------------------------------------------
''' <summary>
''' this method will make sure that the leasetime will be
infinite
''' </summary>
''' <returns>Nothing as valid lease point expiration time
</returns>
''' <remarks>
''' </remarks>
''' <history>
''' [michel] 6/4/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Overrides Function InitializeLifetimeService() As Object
Return Nothing
End Function
#End Region

hth

michel




dange said:
Hi

I want to access a remote object to raise an event. How do I get the
reference to the object from the server application?
I tried to use a singleton but this does not work.

thanks
Dan
 
D

dange

This works for the client, but from the server I get still another instance
of the remote object, even if the remote object was already used (created) by
the client.

Dan


Michel Posseth said:
Well in that case it should be pretty simple
you can just create a sub in your interface and thus raise the event from
the sub from anny client atached to the singleton

hth

Michel




dange said:
Hi Michel

As this is my first project with remoting I started with downloading an
example that shows the basic event usage with a chat application. This
example already contains your code region.
Raising the event from within the remote object works fine, but from
another
server class is not working

Dan

Michel Posseth said:
I tried to use a singleton but this does not work.

Guessing...that you know how remoting works ?

You should use a singleton with a lease timeout set to infinite
otherwise ,
it will still create new instances

copy and paste this region in your singleton
#Region " Remoting Override "
''' -----------------------------------------------------------------------------
''' <summary>
''' this method will make sure that the leasetime will be
infinite
''' </summary>
''' <returns>Nothing as valid lease point expiration time
</returns>
''' <remarks>
''' </remarks>
''' <history>
''' [michel] 6/4/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Overrides Function InitializeLifetimeService() As Object
Return Nothing
End Function
#End Region

hth

michel




"dange" <[email protected]> schreef in bericht
Hi

I want to access a remote object to raise an event. How do I get the
reference to the object from the server application?
I tried to use a singleton but this does not work.

thanks
Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top