public static void Run() { // var server = ScsServerFactory.CreateServer(new ScsTcpEndPoint(10033)); var server = SslScsServerFactory.CreateSslServer(new ScsTcpEndPoint(10033) , Consts.ServerPublicPrivateKey , null, SslScsAuthMode.ServerAuth); server.ClientConnected += server_ClientConnected; server.Start(); Console.WriteLine("Press enter to stop server"); Console.ReadLine(); server.Stop(); }
static void Main() { var serverPrivateandPublicKeys = new X509Certificate2(@"C:\Users\node\Desktop\scs\SSLSamples\CertificateFiles\Server\privateKey.pfx", "123456789"); //Create a server that listens 10085 TCP port for incoming connections //var server = ScsServerFactory.CreateServer(new ScsTcpEndPoint(10085)); var server = SslScsServerFactory.CreateSslServer(new ScsTcpEndPoint(10085) , serverPrivateandPublicKeys , null , SslScsAuthMode.ServerAuth); //Register events of the server to be informed about clients server.ClientConnected += Server_ClientConnected; server.ClientDisconnected += Server_ClientDisconnected; server.Start(); //Start the server Console.WriteLine("Server is started successfully. Press enter to stop..."); Console.ReadLine(); //Wait user to press enter server.Stop(); //Stop the server }
static void Main() { var serverPublicPrivateKeys = new X509Certificate(@"C:\Users\node\Desktop\scs\SSLSamples\CertificateFiles\Server\privateKey.pfx", "123456789"); //var server = ScsServerFactory.CreateServer(new ScsTcpEndPoint(10033)); var server = SslScsServerFactory.CreateSslServer(new ScsTcpEndPoint(10033) , serverPublicPrivateKeys , null , SslScsAuthMode.ServerAuth); server.WireProtocolFactory = new MyWireProtocolFactory(); //Set custom wire protocol factory! server.ClientConnected += server_ClientConnected; server.Start(); Console.WriteLine("Press enter to stop server"); Console.ReadLine(); server.Stop(); }
/// <summary> /// /// </summary> /// <param name="endPoint"></param> /// <param name="serverCert"></param> /// <param name="clientCerts"></param> /// <param name="authMode"></param> /// <returns></returns> public static IScsServiceApplication CreateSslService(ScsEndPoint endPoint, X509Certificate serverCert, List <X509Certificate2> clientCerts, SslScsAuthMode authMode) { return(new ScsServiceApplication(SslScsServerFactory.CreateSslServer(endPoint, serverCert, clientCerts, authMode))); }