Пример #1
0
        private static void Main(string[] args)
        {
            _encrypt  = true;
            _compress = true;

            var jsonSer = new MessageTesting.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");

            _client = new SimpleSocketTcpClient();
            //_client = new SimpleSocketTcpSslClient(cert);

            _client.ObjectSerializer    = jsonSer;
            _client.EnableExtendedAuth  = true;
            _client.AllowReceivingFiles = true;


            //Create the MessageContract implementation and add to the client
            _messageAContract = new MessageA("MessageAHeader");
            _client.AddMessageContract(_messageAContract);
            //Bind MessageContract Event
            _messageAContract.OnMessageReceived += MessageAContractOnOnMessageReceived;

            BindEvents();


            _client.StartClient("127.0.0.1", 13000);
            while (true)
            {
                Options();


                WriteLine("Press any key to continue...");
                System.Console.Read();
                System.Console.Clear();
            }
        }
Пример #2
0
        private static void Main(string[] args)
        {
            _encrypt  = true;
            _compress = false;

            var xmlSer = new XmlSerialization();
            var binSer = new BinarySerializer();

            _client = new SimpleSocketTcpClient();
            //_client = new SimpleSocketTcpSslClient(@"PATH\TO\CERT.pfx", "Password");

            _client.ObjectSerializer    = binSer;
            _client.EnableExtendedAuth  = true;
            _client.AllowReceivingFiles = true;


            //Create the MessageContract implementation and add to the client
            _messageAContract = new MessageA("MessageAHeader");
            _client.AddMessageContract(_messageAContract);
            //Bind MessageContract Event
            _messageAContract.OnMessageReceived += MessageAContractOnOnMessageReceived;

            BindEvents();
            _client.StartClient("127.0.0.1", 13000);


            while (true)
            {
                Options();


                WriteLine("Press any key to continue...");
                System.Console.Read();
                System.Console.Clear();
            }
        }