public static void Main() { Console.Write("\n Servers01 starting up....!!"); Console.Write("\n ==================================\n"); try { Client cl = new Client(); CommService service = new CommService(); BasicHttpBinding binding0 = new BasicHttpBinding(); Uri address0 = new Uri("http://localhost:8087/ICommService/BasicHttp"); using (service.host = new ServiceHost(typeof(CommService), address0)) { service.host.AddServiceEndpoint(typeof(ICommService), binding0, address0); service.host.Open(); Console.Write("\n CommService is ready."); Console.Write("\n Maximum BasicHttp message size = {0}", binding0.MaxReceivedMessageSize); Console.WriteLine(); Thread child = new Thread(new ThreadStart(service.ThreadProc)); //Thread ch1 = new Thread(new ThreadStart(service.ServerSender)); child.Start(); //ch1.Start(); child.Join(); //ch1.Join(); Console.Write("\n\n Press <ENTER> to terminate service.\n\n"); Console.ReadLine(); } } catch (Exception ex) { Console.Write("\n {0}\n\n", ex.Message); } }
public static void Main() { Console.Write("\n Communication Server Starting up"); Console.Write("\n ==================================\n"); try { CommService service = new CommService(); // - We're using WSHttpBinding and NetTcpBinding so digital certificates // are required. // - Both these bindings support ordered delivery of messages by default. BasicHttpBinding binding0 = new BasicHttpBinding(); WSHttpBinding binding1 = new WSHttpBinding(); NetTcpBinding binding2 = new NetTcpBinding(); Uri address0 = new Uri("http://localhost:4030/ICommService/BasicHttp"); Uri address1 = new Uri("http://localhost:4040/ICommService/WSHttp"); Uri address2 = new Uri("net.tcp://localhost:4050/ICommService/NetTcp"); using (service.host = new ServiceHost(typeof(CommService), address1)) { service.host.AddServiceEndpoint(typeof(ICommService), binding0, address0); service.host.AddServiceEndpoint(typeof(ICommService), binding1, address1); service.host.AddServiceEndpoint(typeof(ICommService), binding2, address2); service.host.Open(); Console.Write("\n CommService is ready."); Console.Write("\n Maximum BasicHttp message size = {0}", binding0.MaxReceivedMessageSize); Console.Write("\n Maximum WSHttp message size = {0}", binding1.MaxReceivedMessageSize); Console.Write("\n Maximum NetTcp message size = {0}", binding2.MaxReceivedMessageSize); Console.WriteLine(); Thread child = new Thread(new ThreadStart(service.ThreadProc)); child.Start(); child.Join(); Console.Write("\n\n Press <ENTER> to terminate service.\n\n"); Console.ReadLine(); } } catch (Exception ex) { Console.Write("\n {0}\n\n", ex.Message); } }
/// <summary> /// //////////////////////////////////////////////////////////////////////// /// Reciever Thread function for getting the analysis function from the server public void ClientRecieverMain1(ref List<string> a) { Console.Write("\n Communication Server Starting up"); Console.Write("\n ==================================\n"); List<string> projects = new List<string>(); CommunicationPrototype.Client cl = new CommunicationPrototype.Client(); try { CommService service = new CommService(); BasicHttpBinding binding0 = new BasicHttpBinding(); Uri address0 = new Uri("http://localhost:" + portno_ + "/ICommService/BasicHttp"); using (service.host_ = new ServiceHost(typeof(CommService), address0)) { service.host_.AddServiceEndpoint(typeof(ICommService), binding0, address0); service.host_.Open(); Message msg = new Message(); msg.text = " "; while (connectedservers1_.Count == 0) { if (noservers_) return; } Thread.Sleep(1000); int count = connectedservers1_.Count; while (count != 0) { count--; msg = service.GetMessage(); typetables_.Add(msg.text); a.Add(msg.text); } } } catch (Exception ex) { Console.Write("\n {0}\n\n", ex.Message); } }