Groups | Blog | Home
all groups > dotnet remoting > september 2007 >

dotnet remoting : Getting at form or other data from singlecall thread on server?


Grant Schenck
9/14/2007 10:54:59 AM
Hello,

I'm starting to work with remoting and I have a question about how to get at
data in the method call associated with a singlecall thread on my server?

Specifically, this is my code on the server:

// Opens passive or "listening" socket,
// or throws an exception
m_Channel = new TcpChannel(m_TCPPortServerListen);

// Lets the remoting system use the socket
ChannelServices.RegisterChannel(m_Channel, false);

// Associate the class CHMScheduleServer with the URI "SayHello"
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(STCHMScheduleServer), //type
"SayHello", //uri
WellKnownObjectMode.SingleCall); //mode

My type's parameter-less constructor then gets called when the client
invokes the method. This shows the code for my type:

public STCHMScheduleServer()
{
Trace.WriteLine("STCHMScheduleServer activated");
}

No, I'd like to pass an object to my server's remoted class so the methods
can comminicate with the rest of the process.

This is my question:

"How can my remoted methods get access to data in my process?"

In a perfect world I'd be able to get an object in my constructor, something
like this:

public STCHMScheduleServer(object myObject)
...

Thanks!
--
Grant Schenck


John Saunders [MVP]
9/14/2007 9:07:59 PM
[quoted text, click to view]

I'm confused. Can't you pass those objects to the server as parameters of
method calls?
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
Grant Schenck
9/16/2007 8:29:57 AM
Hi John,

The issue wasn't getting data from client to server, rather it was getting
data to/from my server's remote objects and data contained in my server. I
ended up using a singleton object which, because I create it, I can pass
data to my contstructor. I never could figure out how the server object
created by the remoting infrastructure could reference other data in my
service...

No big deal, thanks.
--
Grant Schenck

[quoted text, click to view]

AddThis Social Bookmark Button