コード例 #1
0
        /// <summary>
        /// Saves the address passed in, and really connects to m_host:m_port.
        /// </summary>
        /// <param name="addr"></param>
        public override void Connect(bedrock.net.Address addr)
        {
            m_remote_addr = addr; // save this till we are ready for it...
            Debug.Assert(m_host != null);
            Debug.Assert(m_port != 0);
            // connect to the proxy.
            Address proxy_addr = new Address(m_host, m_port);

            m_sock.Connect(proxy_addr, m_hostid);
            // we'll end up in OnConnected below.
        }
コード例 #2
0
        /// <summary>
        /// Connects the outbound socket.
        /// </summary>
        public override void Connect()
        {
            int port = (int)m_listener[Options.PORT];
            Debug.Assert(port > 0);

            m_sock = CreateSocket();

            string to = (string)m_listener[Options.TO];
            Debug.Assert(to != null);

            string host = (string)m_listener[Options.NETWORK_HOST];
            if ((host == null) || (host == ""))
                host = to;

            string url = (string)m_listener[Options.POLL_URL];
            if ((url == null) || (url == ""))
            {
            #if !__MonoCS__
                url = Address.LookupTXT("_xmppconnect.", to, "_xmpp-client-xbosh");
                if (url == null)
            #endif
                    throw new ArgumentNullException("URL not found in DNS, and not specified", "URL");
            }
            ((IHttpSocket)m_sock).URL = url;

            //Address addr = new Address(host, port);
            m_sock.Connect(null, (string)m_listener[Options.SERVER_ID]);
        }