Ken Kolda
9/7/2004 3:08:00 PM
You've made it more complicated than it needs to be. Here's your server-side
code:
public Session Login(string uiserId, string userPsw)
{
return new Session();
}
On the client side, just use:
Session session = server.Login("ciao", "bella");
session.Initialize();
There's no need to deal with all the ObjRef marshalling directly as that
will be taken care of for you by .NET.
Ken
"Maurizio Poletto" <MaurizioPoletto@discussions.microsoft.com> wrote in
message news:DADC4C96-E6C1-4341-ACBE-23076BE72A57@microsoft.com...
> Thank for your quick reply.
> I have followed any your advise but something seems not to run well!.
> In the server I wrote:
>
> public ObjRef Login(string userId, stringUserPsw)
> {
> Session session = new Session();
> return RemotingServices.Marshal(session);
> }
>
> while, in the client, I wrote:
>
> ObjRef obj = server.Login("ciao","bella");
> Object proxy = RemotingServices.Unmarshal(obj);
> Session session = (Session)RemoteingServices.Connect(typeof(Session),
> "tcp://localhost:8080//Session");
>
> and, after, when I call a method of Session
>
> session.Initialize();
>
> I have an exception i.e. "Requested Service not found"
>
> I understand that this problem was solved successfully, but I spent a lot
of
> time without a happy solution. A bit of help is appreciate!
> Ciao
> Maurizio
>
>
>
>
> "Maurizio Poletto" wrote:
>
> > A singleton object (server) has a method (login) to let to every client
to
> > connect to the server. I should like to return a new object (session)
with
> > new methods.
> >
> > So, in the client, we have
> > Session session = server.login(userId, userPsw);
> >
> > while, in the server, we have
> > Session Login(string Id, string Psw)
> > {
> > ...
> > ...
> > Session session = new Session();
> > return session;
> > }
> >
> > I would appreciate any ideas on how to return an object created in the
server?
> > Regards
> > Maurizio