Example #1
0
        /// <summary>
        /// 启动
        /// </summary>
        /// <param name="httpUrl"></param>
        /// <param name="Server1078"></param>
        /// <param name="Port1078"></param>
        /// <returns></returns>
        public static JTHClient Start(JTTask MyTask, string Key, string httpUrl, string Server1078, int Port1078)
        {
            var mth = regUrl.Match(httpUrl);

            if (!mth.Success)
            {
                return(null);
            }
            var ip   = mth.Groups[1].Value;
            var port = Convert.ToInt32(mth.Groups[2].Value);

            var jthc = new JTHClient();

            jthc.httpUrl      = httpUrl;
            jthc.HandShakeUrl = "/" + HttpUtility.UrlEncode(mth.Groups[3].Value);
            jthc.Server1078   = Server1078;
            jthc.Port1078     = Port1078;
            jthc.Key          = Key;
            jthc.MyTask       = MyTask;

            var channel = new TCPChannel(ip, port);

            jthc.channelhttp        = channel;
            channel.DataReceive     = jthc.Receive;
            channel.DataSend        = jthc.DataSend;
            channel.ChannelDispose += jthc.Http_ChannelDispose;
            channel.ChannelConnect += jthc.Http_ChannelConnect;
            channel.Connect();


            return(jthc);
        }
Example #2
0
        public bool StartNewHttp2RTP(string httpUrl, string Server1078, int Port1078)
        {
            var key    = GetKey();
            var jtHttp = JTHClient.Start(this, key, httpUrl, Server1078, Port1078);

            if (jtHttp == null)
            {
                return(false);
            }
            dit[key] = jtHttp;
            return(true);
        }
Example #3
0
        public static JT1078Client Start(JTHClient jtHttp, string Server1078, int Port1078)
        {
            JT1078Client jt1078 = new JT1078Client();

            jt1078.jtHttp = jtHttp;
            var channel = new TCPChannel(Server1078, Port1078);

            jt1078.channel1078      = channel;
            channel.DataReceive     = jt1078.Receive;
            channel.DataSend        = jt1078.DataSend;
            channel.ChannelDispose += jt1078.ChannelDispose;
            channel.ChannelConnect += jt1078.ChannelConnect;
            channel.Connect();
            return(jt1078);
        }