コード例 #1
0
    //TODO TLS "C7773B9D1BF0C5C956C88C60440FA23C3889A403"
    public bool ConnectServer(string host, int port,
                              ClientProtocolType eProtoType = ClientProtocolType.NORMAL,
                              string HandShakeCache         = "",
                              byte[] clientcert             = null, string clientpwd = "", string cathumbprint = null)
    {
        //if (eProtoType == ClientProtocolType.TLS)
        //{
        //    if (clientcert == null || cathumbprint == null)
        //    {
        //        return false;
        //    }
        //}

        //this.CloseClient();
        pc = new PomeloClient(eProtoType, clientcert, "", cathumbprint);
        pc.Connect(host, port, HandShakeCache, delegate()
        {
            if (pc.IsConnected)
            {
                this.UpdateClient();
                pc.HandShake(null, delegate(JsonData data)
                {
                    if (this.connectEvent != null)
                    {
                        this.connectEvent();
                    }
                });
            }
        },
                   delegate()
        {
            if (this.closeEvent != null)
            {
                this.closeEvent();
            }
        }
                   );

        return(true);
    }