static void Main(string[] args) { //Optionally, set a work directory where server queue files will be created if (System.Environment.OSVersion.Platform == PlatformID.Unix) { CSocketProServer.QueueManager.WorkDirectory = "/home/yye/cyetest/"; } else { CSocketProServer.QueueManager.WorkDirectory = "c:\\sp_test"; } using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { //pre-open a queue file, which may take long time if the existing queue file is very large CServerQueue sq = CSocketProServer.QueueManager.StartQueue("qperf", 24 * 3600); int param = 1; param <<= 24; //disable server enqueue notification param += 32 * 1024; //32 * 1024 batch dequeuing size in bytes IntPtr p = CSocketProServer.DllManager.AddALibrary("uasyncqueue", param); //32 * 1024 batch dequeuing size in bytes if (p.ToInt64() == 0) { Console.WriteLine("Cannot load async persistent queue library"); } else if (!MySocketProServer.Run(20901)) { Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); } Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
static void Main(string[] args) { CMySqlCachePeer.CCacheSource source = new CMySqlCachePeer.CCacheSource("root", "Smash123"); //server cache contains five tables (city, language, store, category, and staff) of MySql sample database sakila source.TableFilter["sakila.city"] = ""; source.TableFilter["sakila.language"] = ""; source.TableFilter["sakila.store"] = ""; source.TableFilter["sakila.category"] = ""; source.TableFilter["sakila.staff"] = ""; const string mysql_host = "ws-yye-1"; //query all the above five tables into cache on one given MySql server located at ws-yye-1 string errMsg = CMySqlCachePeer.InitializeCache(mysql_host, source); if (errMsg != null && errMsg.Length > 0) Console.WriteLine(errMsg); else { #if DEBUG Console.WriteLine("Real-time server cache initialized from MySql server " + mysql_host); //query a datatable from cache DataTable dt = CMySqlCachePeer.Get(mysql_host, "sakila.staff"); //query a subset of records from cache dt = CMySqlCachePeer.Get(mysql_host, "sakila.city", "city_id >= 10 and city_id <= 19", "city_id"); #endif } using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { if (!MySocketProServer.Run(20901)) Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
static void Main(string[] args) { if (System.Environment.OSVersion.Platform == PlatformID.Unix) { CSocketProServer.QueueManager.WorkDirectory = "/home/yye/sp_test/"; } else { CSocketProServer.QueueManager.WorkDirectory = "c:\\sp_test"; } using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { //CSocketProServer.QueueManager.MessageQueuePassword = "******"; //test certificate, private key and DH params files are located at the directory ..\SocketProRoot\bin //MySocketProServer.UseSSL("server.pem", "server.pem", "test"); if (!MySocketProServer.Run(20901)) { Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); } else { CSocketProServer.Router.SetRouting(piConst.sidPi, piConst.sidPiWorker); } Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
static void Main(string[] args) { using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { //test certificate and private key files are located at ../SocketProRoot/bin //if (System.Environment.OSVersion.Platform == PlatformID.Unix) // MySocketProServer.UseSSL("intermediate.cert.pem", "intermediate.key.pem", "mypassword"); //else //{ // MySocketProServer.UseSSL("intermediate.pfx", "", "mypassword"); // //MySocketProServer.UseSSL("root"/*"my"*/, "UDAParts Intermediate CA", ""); //or load cert and private key from windows system cert store //} if (!MySocketProServer.Run(20901)) { Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); } else { CSocketProServer.Router.SetRouting(piConst.sidPi, piConst.sidPiWorker); } Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
//One SocketPro server supports any number of services. You can list them here! static void Main(string[] args) { CMySocketProServer MySocketProServer = new CMySocketProServer(); if (!MySocketProServer.Run(20901)) Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); MySocketProServer.StopSocketProServer(); //or MySocketProServer.Dispose(); }
static void Main(string[] args) { using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { if (!MySocketProServer.Run(20901)) { Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); } Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
static void Main(string[] args) { CMySocketProServer MySocketProServer = new CMySocketProServer(); if (!MySocketProServer.Run(21911)) { Console.WriteLine("Error code = " + SocketProAdapter.ServerSide.CSocketProServer.LastSocketError.ToString()); } Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); MySocketProServer.StopSocketProServer(); }
static void Main(string[] args) { using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { if (!MySocketProServer.Run(20901)) Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); else CSocketProServer.Router.SetRouting(piConst.sidPi, piConst.sidPiWorker); Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
static void Main(string[] args) { if (System.Environment.OSVersion.Platform == PlatformID.Unix) CSocketProServer.QueueManager.WorkDirectory = "/home/yye/sp_test/"; else CSocketProServer.QueueManager.WorkDirectory = "c:\\sp_test"; using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { //CSocketProServer.QueueManager.MessageQueuePassword = "******"; if (!MySocketProServer.Run(20901)) Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
//One SocketPro server supports any number of services. You can list them here! static void Main(string[] args) { CMySocketProServer MySocketProServer = new CMySocketProServer(); //test certificate and private key files are located at ../SocketProRoot/bin if (System.Environment.OSVersion.Platform == PlatformID.Unix) MySocketProServer.UseSSL("intermediate.cert.pem", "intermediate.key.pem", "mypassword"); else { MySocketProServer.UseSSL("intermediate.pfx", "", "mypassword"); //MySocketProServer.UseSSL("root"/*"my"*/, "UDAParts Intermediate CA", ""); //or load cert and private key from windows system cert store } if (!MySocketProServer.Run(20901)) Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); MySocketProServer.StopSocketProServer(); //or MySocketProServer.Dispose(); }
static void Main(string[] args) { CMySqlCachePeer.CCacheSource source = new CMySqlCachePeer.CCacheSource("root", "Smash123"); //server cache contains five tables (city, language, store, category, and staff) of MySql sample database sakila source.TableFilter["sakila.city"] = ""; source.TableFilter["sakila.language"] = ""; source.TableFilter["sakila.store"] = ""; source.TableFilter["sakila.category"] = ""; source.TableFilter["sakila.staff"] = ""; const string mysql_host = "ws-yye-1"; //query all the above five tables into cache on one given MySql server located at ws-yye-1 string errMsg = CMySqlCachePeer.InitializeCache(mysql_host, source); if (errMsg != null && errMsg.Length > 0) { Console.WriteLine(errMsg); } else { #if DEBUG Console.WriteLine("Real-time server cache initialized from MySql server " + mysql_host); //query a datatable from cache DataTable dt = CMySqlCachePeer.Get(mysql_host, "sakila.staff"); //query a subset of records from cache dt = CMySqlCachePeer.Get(mysql_host, "sakila.city", "city_id >= 10 and city_id <= 19", "city_id"); #endif } using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { if (!MySocketProServer.Run(20901)) { Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); } Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
static void Main(string[] args) { if (System.Environment.OSVersion.Platform == PlatformID.Unix) { CSocketProServer.QueueManager.WorkDirectory = "/home/yye/sp_test/"; } else { CSocketProServer.QueueManager.WorkDirectory = "c:\\sp_test"; } using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { //CSocketProServer.QueueManager.MessageQueuePassword = "******"; if (!MySocketProServer.Run(20901)) { Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); } Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
static void Main(string[] args) { //Optionally, set a work directory where server queue files will be created if (System.Environment.OSVersion.Platform == PlatformID.Unix) CSocketProServer.QueueManager.WorkDirectory = "/home/yye/cyetest/"; else CSocketProServer.QueueManager.WorkDirectory = "c:\\sp_test"; using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { int param = 1; param <<= 24; //disable server enqueue notification param += 24 * 1024; //24 * 1024 batch dequeuing size in bytes IntPtr p = CSocketProServer.DllManager.AddALibrary("uasyncqueue", param); //24 * 1024 batch dequeuing size in bytes if (p.ToInt64() == 0) Console.WriteLine("Cannot load async persistent queue library"); else if (!MySocketProServer.Run(20901)) Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
static void Main(string[] args) { using (CMySocketProServer server = new CMySocketProServer()) { //test certificate and private key files are located at ../socketpro/bin /* * if (System.Environment.OSVersion.Platform == PlatformID.Unix) * server.UseSSL("intermediate.cert.pem", "intermediate.key.pem", "mypassword"); * else * { * server.UseSSL("intermediate.pfx", "", "mypassword"); * //or load cert and private key from windows system cert store * //server.UseSSL("root", "UDAParts Intermediate CA", ""); * } */ if (!server.Run(20901)) { Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); } Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }
static void Main(string[] args) { if (System.Environment.OSVersion.Platform == PlatformID.Unix) CSocketProServer.QueueManager.WorkDirectory = "/home/yye/sp_test/"; else CSocketProServer.QueueManager.WorkDirectory = "c:\\sp_test"; using (CMySocketProServer MySocketProServer = new CMySocketProServer()) { //CSocketProServer.QueueManager.MessageQueuePassword = "******"; //test certificate, private key and DH params files are located at the directory ..\SocketProRoot\bin //MySocketProServer.UseSSL("server.pem", "server.pem", "test"); if (!MySocketProServer.Run(20901)) Console.WriteLine("Error code = " + CSocketProServer.LastSocketError.ToString()); else { CSocketProServer.Router.SetRouting(piConst.sidPi, piConst.sidPiWorker); } Console.WriteLine("Input a line to close the application ......"); Console.ReadLine(); } }