static void Main(string[] args) { /*This is opening the server as a host to receive messages */ ServiceHost host = CreateServiceChannel("http://localhost:8080/MessageService"); host.Open(); /* IMessageService proxy = CreateClientChannel("http://localhost:8081/MessageService"); * * List<string> projects = new List<string>(); * projects.Add("Project #1"); * projects.Add("Project #2"); * * * SvcMsg msg = new SvcMsg(); * msg.src = new Uri("http://localhost:8080/MessageService"); * msg.dst = new Uri("http://localhost:8081/MessageService"); * msg.cmd = SvcMsg.Command.ProjectList; * msg.body = ConvertToXml(projects); * proxy.SendMessage(msg); */ /*SEND A MESSAGE TO SERVER-2 REQUESTING ITS TYPE TABLE AND SENDING SERVER-1'S TYPE TABLE*/ IMessageService serverproxy = CreateClientChannel("http://localhost:8081/MessageService"); SvcMsg typeMsg = new SvcMsg(); typeMsg.src = new Uri("http://localhost:8080/MessageService"); typeMsg.dst = new Uri("http://localhost:8081/MessageService"); typeMsg.cmd = SvcMsg.Command.TypeTable; //typeMsg.body = typeDict.ToString() ; serverproxy.SendMessage(typeMsg); Console.Write("\n press key to terminate service\n"); Console.ReadKey(); Console.Write("\n"); host.Close(); }
public void SendMessage(SvcMsg msg) { msg.ShowMessage(); }