.Net Remoting - Post Message to Server/Host with parameters

What I need to be able to do is pass in 2 parameters (Int, IntPtr) from a client application to the host application.

I already have code that gets data from the host when the client loads using the below code on the host but I need to extend it for this scenario...


//This registers a channel for Cam Applications to listen on
TcpChannel tcpChannel = new TcpChannel(6400); 

ChannelServices.RegisterChannel(tcpChannel, false);
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;

//This Registers the URI (Method) for the client to call to get AppData
RemotingServices.Marshal(AppData, "GetAppData"); 


//I now want to allow the client to pass in some information to the host. How do I do this?

Open in new window

CAMSYSTEMSAsked:
Who is Participating?
 
CAMSYSTEMSConnect With a Mentor Author Commented:
Managed to fix it - I was looking from the wrong angle....

All I needed to do is return a class from the server and call a method on that class...
Type requiredType = typeof(IApplicationCommunicator);
                object o = Activator.GetObject(requiredType, "tcp://" + host + ":6400/GetAppCommunicator");
                if (o is IApplicationCommunicator)
                {
                    appCommunicator = (IApplicationCommunicator)o;
                    appCommunicator.SendApplicationHandle(mainWindowHandle, Process.GetCurrentProcess().Id);
                }

Open in new window

0
 
CAMSYSTEMSAuthor Commented:
Any ideas?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.