static void Main(string[] args) { HproseTcpListenerServer tcpserver = new HproseTcpListenerServer("tcp4://127.0.0.1:4321/"); tcpserver.Add("Hello", typeof(Program)); tcpserver.Start(); HproseHttpListenerServer httpserver = new HproseHttpListenerServer("http://localhost:8888/"); httpserver.Add("Hello", typeof(Program)); httpserver.Start(); Console.ReadKey(); tcpserver.Stop(); httpserver.Stop(); }
static void Main(string[] args) { ClassManager.Register(typeof(User), "User"); HproseHttpListenerServer server = new HproseHttpListenerServer("http://localhost:2012/"); server.Methods.AddInstanceMethods(new TestService()); server.IsCrossDomainEnabled = true; server.CrossDomainXmlFile = "crossdomain.xml"; server.Start(); Console.WriteLine("Server started."); Console.ReadLine(); Console.WriteLine("Server stopped."); }
static void Main(string[] args) { HproseClassManager.Register(typeof(User), "User"); HproseHttpListenerServer server = new HproseHttpListenerServer("http://localhost:2012/"); TestService ts = new TestService(); server.Add("Hello", ts, true); server.Add("SendUsers", ts); server.IsCrossDomainEnabled = true; server.CrossDomainXmlFile = "crossdomain.xml"; server.Start(); Console.WriteLine("Server started."); Console.ReadLine(); Console.WriteLine("Server stopped."); }