Example #1
0
        /// <summary>
        /// Process the answer from a server
        /// </summary>
        /// <remarks>
        /// A client receives a reply from a server, this method processes the
        /// reply and raises an event
        /// </remarks>
        /// <param name="response">Response that came from the server</param>
        /// <param name="endpoint">Address of the server that replied</param>
        protected override void ProcessResponse(DiscoveryResponse _response, IPEndPoint _endpoint)
        {
            //heckin what now?
            #region hecc
            _response.EndPoint = _endpoint; //received message remote endpoint (host)

            //turn url into uri bc otherwise might not resolve
            UriBuilder realUri = new UriBuilder(_response.uri)
            {
                Host = _response.EndPoint.Address.ToString()
            };

            _response.uri = realUri.Uri; //make the response real
            #endregion

            onServerFound.Invoke(_response);
        }
    /// <summary>
    /// Process the answer from a server
    /// </summary>
    /// <remarks>
    /// A client receives a reply from a server, this method processes the
    /// reply and raises an event
    /// </remarks>
    /// <param name="response">Response that came from the server</param>
    /// <param name="endpoint">Address of the server that replied</param>
    protected override void ProcessResponse(DiscoveryResponse response, IPEndPoint endpoint)
    {
        // we received a message from the remote endpoint
        response.EndPoint = endpoint;

        // although we got a supposedly valid url, we may not be able to resolve
        // the provided host
        // However we know the real ip address of the server because we just
        // received a packet from it,  so use that as host.
        UriBuilder realUri = new UriBuilder(response.uri)
        {
            Host = response.EndPoint.Address.ToString()
        };

        response.uri = realUri.Uri;

        OnServerFound.Invoke(response);
    }
Example #3
0
        /// <summary>
        /// Process the answer from a server
        /// </summary>
        /// <remarks>
        /// A client receives a reply from a server, this method processes the
        /// reply and raises an event
        /// </remarks>
        /// <param name="_response">Response that came from the server</param>
        /// <param name="_endpoint">Address of the server that replied</param>
        protected override void ProcessResponse(DiscoveryResponse _response, IPEndPoint _endpoint)
        {
            // We don't fully understand this code, we just know it's something we need to do.
            // we recieved a message from the remote endpoint
            _response.EndPoint = _endpoint;

            // although we got a supposedly valid url we may not be able to resolve
            // the provided host
            // However we know the real ip address ip address of the server because we just
            // recieve a packet from it, so use that as host.
            UriBuilder realUri = new UriBuilder(_response.uri)
            {
                Host = _response.EndPoint.Address.ToString()
            };

            _response.uri = realUri.Uri;

            onServerFound.Invoke(_response);
        }
Example #4
0
        /// <summary>
        /// Process the answer from a server
        /// </summary>
        /// <remarks>
        /// A client receives a reply from a server, this method processes the
        /// reply and raises an event
        /// </remarks>
        /// <param name="_response">Response that came from the server</param>
        /// <param name="_endpoint">Address of the server that replied</param>
        protected override void ProcessResponse(DiscoveryResponse _response, IPEndPoint _endpoint)
        {
            #region "You don't need to understand what this is doing." - James Mills, 2021
            // We recieved a message from the remote endpoint.
            _response.endpoint = _endpoint;

            // Although we got a supposedly valid url, we may not be able to
            // resolve the provided host. However, we know the real ip
            // adress of the server because we just recieved a packert from
            // it. So, we use that as host.
            UriBuilder realUri = new UriBuilder(_response.uri)
            {
                Host = _response.endpoint.Address.ToString()
            };
            _response.uri = realUri.Uri;
            #endregion

            onServerFound.Invoke(_response);
        }
        /// <summary>
        /// Process the answer from a server
        /// </summary>
        /// <remarks>
        /// A client receives a reply from a server, this method processes the
        /// reply and raises an event
        /// </remarks>
        /// <param name="response">Response that came from the server</param>
        /// <param name="endpoint">Address of the server that replied</param>
        protected override void ProcessResponse(DiscoveryResponse _response, IPEndPoint _endpoint)
        {
            //WE DONT FULLY UNDERSTAND THIS CODE BUT IT'S SOMETHING WE NEED TO DO WHICH IS IMPORTANT SO DEAL WITH IT
            //We received a message from the remote endpoint ()
            _response.EndPoint = _endpoint;

            //although we got a supposedly valid url we may not be able to resolve
            //the provided host/connection
            //however we know the real ip address of the server because we just
            //received a packet from it, so use that as host (convert to correct uri from url).
            UriBuilder realUri = new UriBuilder(_response.uri)
            {
                Host = _response.EndPoint.Address.ToString()
            };

            _response.uri = realUri.Uri;

            onServerFound.Invoke(_response);
        }
Example #6
0
        /// <summary>
        /// Process the answer from a server
        /// </summary>
        /// <remarks>
        /// A client receives a reply from a server, this method processes the
        /// reply and raises an event
        /// </remarks>
        /// <param name="response">Response that came from the server</param>
        /// <param name="endpoint">Address of the server that replied</param>
        protected override void ProcessResponse(DiscoveryResponse _response, IPEndPoint _endpoint)
        {
            //We don't fully understand this code, we just know it's something we need to do.
            #region WTF
            //We received a messaged from the remote endpoint.
            _response.EndPoint = _endpoint;

            // Although we got a supposedly valid url, we may not be able to resolve the
            //provided host (i.e. may be an invalid connection).
            //However, we know the real ip address of the server because
            //we just receive a packet from it, so use that as host. So we can convert it
            UriBuilder realUri = new UriBuilder(_response.uri)
            {
                Host = _response.EndPoint.Address.ToString()
            };
            _response.uri = realUri.Uri;
            #endregion

            onServerFound.Invoke(_response);
        }
 protected override void ResponseReceived(IPEndPoint sender, DiscoveryResponseData response)
 {
     OnServerFound.Invoke(sender, response);
 }