Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     Log.displayTime = true;
     //HTTPOp.Init();
     EchoProtocolCallback.StartEchoServer("127.0.0.1", 1010);
     //EchoProtocolCallback.StartEchoClient("127.0.0.1", 1010, "a hi", false);
     //EchoProtocolCallback.StartEchoClient("127.0.0.1", 1010, "b hi", false);
     //EchoProtocolCallback.StartEchoClient("127.0.0.1", 1010, "c hi", false);
     //HTTPOp.Request(HTTPMethod.GET, "http://www.oschina.net/",null, RequestCallback);
     System.Console.ReadLine();
 }
Ejemplo n.º 2
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();
    }
Ejemplo n.º 3
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();
    }