1

Possible Duplicate:
Identifying the client during a .NET remoting invocation

I have a client/server app, in which server-side part publishes static object in that way:

RemotingServices.Marshal(rem, "testRemoteObject");

Many client-side parts connect to It simultaneously through:

TestInterface remote = (TestInterface)RemotingServices.Connect(typeof(TestInterface), 
            "tcp://localhost:4500/testRemoteObject");

All is working fine, but I need determine on server-side, which client calls method, like this:

public void PrintMsg(string msg)
{
    Console.WriteLine("Message from client: " + msg);
}

I see one path: each client sends its id as method argument, but in this case clients may send id of another client. How can I do what I want?

Community
  • 1
  • 1
Tadeusz
  • 6,453
  • 9
  • 40
  • 58

1 Answers1

0

Unless you are using the remoting pattern where an object is created for each client, in which case you can use some magic (that I forget OTOH) to store the client in a field/property, I do not believe there is a way.

David Pfeffer
  • 38,869
  • 30
  • 127
  • 202