private static void Main(string[] args) { _encrypt = true; _compress = true; var jsonSer = new JsonSerialization(); var xmlSer = new XmlSerialization(); var binSer = new BinarySerializer(); var cert = new X509Certificate2(File.ReadAllBytes(Path.GetFullPath(@"C:\Users\" + Environment.UserName + @"\Desktop\test.pfx")), "Password"); _listener = new SimpleSocketTcpSslListener(cert); // _listener = new SimpleSocketTcpListener(); _listener.Timeout = new TimeSpan(0, 5, 0); _listener.ObjectSerializer = jsonSer; _listener.AllowReceivingFiles = true; _messageAContract = new MessageA("MessageAHeader"); _listener.AddMessageContract(_messageAContract); _messageAContract.OnMessageReceived += MessageAContractOnOnMessageReceived; BindEvents(); _listener.StartListening(13000); while (true) { Options(); WriteLine("Press any key to continue..."); System.Console.Read(); System.Console.Clear(); } }
private static void Main(string[] args) { _encrypt = false; _compress = false; var xmlSer = new XmlSerialization(); var binSer = new BinarySerializer(); _listener = new SimpleSocketTcpListener(); //_listener = new SimpleSocketTcpSslListener(@"PATH\TO\CERT.pfx","Password"); _listener.ObjectSerializer = binSer; _listener.AllowReceivingFiles = true; _messageAContract = new MessageA("MessageAHeader"); _listener.AddMessageContract(_messageAContract); _messageAContract.OnMessageReceived += MessageAContractOnOnMessageReceived; BindEvents(); _listener.StartListening(13000); while (true) { Options(); WriteLine("Press any key to continue..."); System.Console.Read(); System.Console.Clear(); } }
private static void StartServer() { _server = new SimpleSocketTcpListener(); //_server = new SimpleSocketTcpSslListener(@"C:\Users\CloetOMEN\Desktop\Test\cert.pfx", "Password"); _server.ServerHasStarted += ServerOnServerHasStarted; _server.MessageReceived += ServerOnMessageReceived; _server.ServerErrorThrown += ServerOnServerErrorThrown; _server.StartListening(13000); }
public static void StartAntVaultServer() { if (SetUpEvents == false) { AntVaultServer.ClientConnected += Events_ClientConnected; AntVaultServer.ClientDisconnected += Events_ClientDisconnected; AntVaultServer.BytesReceived += Events_DataReceived; SetUpEvents = true; } CheckConfig(AuxiliaryServerWorker.ConfigFileDir); CheckUserDatabase(AuxiliaryServerWorker.UserDatabaseDir); CheckFileFolders(); AntVaultServer.StartListening("192.168.1.39", 8910); AuxiliaryServerWorker.WriteToConsole("[INFO] Server started on port " + AuxiliaryServerWorker.ReadFromConfig(true, false)); }