0
Reply

Problem with remoting Event

Daniel van Pletzen

Daniel van Pletzen

Aug 27 2007 3:12 PM
1.8k
Hey I got a remoting object as a seperate DLL saved as DVRL.dll
code as below

public class RemoteClass : MarshalByRefObject
    {
        public delegate void MsgSentHandler(String msg);
        public event MsgSentHandler MsgEvent;
        
        public string SendMSG(string msg)
        { if (MsgEvent != null)
                MsgEvent(msg);

            return "Hello";
        }
     }

then in my server application i got
public DVRL.RemoteClass obj;

        private void ServerStart()
        {
            TcpChannel ch = new TcpChannel(8085);
            ChannelServices.RegisterChannel(ch);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(DVRL.RemoteClass), "Remote",WellKnownObjectMode.Singleton);

            obj = new DVRL.RemoteClass();
            obj.MsgEvent += new DVRL.RemoteClass.MsgSentHandler(SayMSG);
        }

        private void SayMSG(String msg)
        {
            MessageBox.Show(msg);
        }

but when i call the method SendMSG the event dont fire.. I do get the "Hello" return on the client tho

please help ;)

Next Recommended Forum