Esempio n. 1
0
        /// <summary>
        /// 绑定
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        public void Bind(string ip, Int32 port)
        {
            UVException exception;
            SockAddr    addr;

            UVIntrop.ip4_addr(ip, port, out addr, out exception);
            if (exception != null)
            {
                throw exception;
            }

            UVIntrop.tcp_bind(this, ref addr, 0);
        }
Esempio n. 2
0
        public void Connect(UVTCPHandle tcp, string ip, Int32 port, Action <UVConnectRquest, Int32, UVException, object> callback, object state)
        {
            this.mCallback = callback;
            this.mState    = state;
            UVException ex;
            SockAddr    addr;

            UVIntrop.ip4_addr(ip, port, out addr, out ex);
            if (ex != null)
            {
                throw ex;
            }

            UVIntrop.tcp_connect(this, tcp, ref addr, UVConnectcb);
        }