Sonny, Thanks for responding. I am pretty sure the server is creating a
local copy (why doesn't it give you an error message when that happens?),
but I am afraid my understanding is not where it needs to be to figure out
how to correct the problem.
> > Here is the code I am using to instantiate the object on both client and
> > server:
> >
> > Dim args() As Object
> >
> > _mSCredentials =
CType(Activator.CreateInstance(GetType(RemotingServer.SingletonCredentials),
> > args), RemotingServer.SingletonCredentials)
Given that I am using the same code in both places, it seems likely that the
config file should be the same in both places in order to work. However, I
have to configure the server AND client on the host, and the client and
server configuration files are different. I tried adding the client setup
to the host config file, but I can't a open port more than once. I guess
one way to do it is to use two separate applications on the server, but is
that the only way?
> I'd suggest to create the stack at server, and to provide methods and/or
> properties to access it from the client. Also, make it sure that
[quoted text clipped - 5 lines]
> Hope that helps
> Sunny
Sunny - 28 Oct 2003 21:45 GMT
Hi David,
> Sonny, Thanks for responding. I am pretty sure the server is creating a
> local copy (why doesn't it give you an error message when that happens?),
[quoted text clipped - 10 lines]
> CType(Activator.CreateInstance(GetType(RemotingServer.SingletonCredentials),
> > > args), RemotingServer.SingletonCredentials)
I'm missing something. Why do you call CreateInstance at the server?
To access that object from server, you may creat an istanse with "new"
keyword, and after that Marshal that object to the remoting system. The
code at server should be something like:
string objectUri = "SingletonCredentials.rem";
//you may use .soap vs .rem
SingletonCredentials myServerObj = new SingletonCredentials();
RemotingServices(myServerObj, objectUri);
You have to remove from the config file the <service> section, and leave
only the <channels>.
In that way you still cann access that object from the servers code
referencing myServerObj, and from the clients, using:
RemotingServer.SingletonCredentials _mSCredentials = new
RemotingServer.SingletonCredentials;
And the clients config shuod look like:
<configuration>
<system.runtime.remoting>
<application>
<client url="tcp://localhost:8080">
<wellknown
type="RemotingServer.SingletonCredentials,RemoteCredentials"
url="tcp://localhost:8080/SingletonCredentials.rem"
/>
</client>
</application>
</system.runtime.remoting>
</configuration>
So, in that way you cann access one and the same object from client and
server. From server you will use myServerObject.DoSomething()
and from client: _mSCredentials.DoSomething()
The above coed is in C#, but you can easily translate it in VB
Hope this helps
Sunny
David Steigerwald - 29 Oct 2003 15:08 GMT
I figured this out after writing that last email, and in fact did exactly
what you suggested. I was just getting ready to document it for the group,
but you saved me the effort!
Thanks for all your help! I had about given up on this group, but thanks to
you it is working (to stretch the United Way theme here). Perhaps the
reason so many questions go unanswered is a matter of not making the request
specific enough. I put in 3 questions, but the one that got a response was
the one I included a complete description of what I was doing and code
snippets.
I'm missing something. Why do you call CreateInstance at the server?
> To access that object from server, you may creat an istanse with "new"
> keyword, and after that Marshal that object to the remoting system. The
[quoted text clipped - 5 lines]
> SingletonCredentials myServerObj = new SingletonCredentials();
> RemotingServices(myServerObj, objectUri);
Sunny - 29 Oct 2003 15:44 GMT
> I figured this out after writing that last email, and in fact did exactly
> what you suggested. I was just getting ready to document it for the group,
[quoted text clipped - 6 lines]
> the one I included a complete description of what I was doing and code
> snippets.
Yes, people think differently :)
No one can easily guess what you have in mind :)
Sunny
Sunny - 28 Oct 2003 22:09 GMT
Sorry, I have typo at the prev. post.
The right line at server code is:
RemotingServices.Marshal(myServerObj, objectUri);