Exemple #1
0
    public static void StartEchoServer(String ip, int port)
    {
        EchoProtocolCallback EchoCallback = new EchoProtocolCallback();
        var sslProtocol = ProtocolOpSsl.BuildProtocolSsl().SetServerCert(@"d:/server.pfx", "1234");

        EchoCallback.UseCustom(sslProtocol);
        //EchoCallback.UseTcp();
        Core EchoServerCore = new UniAsynCore();

        EchoServerCore.SetServer(ip, port, EchoCallback, 10);
        EchoServerCore.StartListen();
        EchoServerCore.Run();
    }
Exemple #2
0
    public static void StartEchoClient(String ip, int port, string data, bool displayReceive)
    {
        EchoProtocolCallback EchoCallback = new EchoProtocolCallback();

        EchoCallback.data           = data;
        EchoCallback.displayReceive = displayReceive;
        var sslProtocol = ProtocolOpSsl.BuildProtocolSsl().SetTargetHost("s");

        EchoCallback.UseCustom(sslProtocol);
        Core EchoClientCore = new UniAsynCore();

        EchoClientCore.SetClient(EchoCallback, true);
        EchoClientCore.Connect(ip, port);
        EchoClientCore.Run();
    }