Esempio n. 1
0
        public void Connect(string ip, int port)
        {
            if (!JsionUtils.IsIP(ip))
            {
                log.ErrorFormat("The target host address is error.IP:{0}, Port:{1}", ip, port);
                return;
            }

            try
            {
                m_socket.IP   = ip;
                m_socket.Port = port;

                m_socket.HadTryTimes = 0;

                TryConnect(m_socket.IP, m_socket.Port);
            }
            catch (Exception ex)
            {
                log.Error("连接失败.", ex);
            }
        }
Esempio n. 2
0
        public void Connect(string ip, int port)
        {
            if (!JsionUtils.IsIP(ip) || port <= 0)
            {
                log.ErrorFormat("The target host address is error.IP:{0}, Port:{1}", ip, port);
                return;
            }

            try
            {
                this.ip   = ip;
                this.port = port;

                m_hadTryTime = 0;

                TryConnect(ip, port);
            }
            catch (Exception ex)
            {
                log.Error("连接失败.", ex);
            }
        }