Ejemplo n.º 1
0
        public void PortCheck(string strUrl)
        {
            this.OnPortCheckerFeedback("checking");

            // Open a connection
            HttpWebRequest WebRequestObject = (HttpWebRequest)HttpWebRequest.Create(strUrl);

            //SAsyncRequestState arsPostData = new SAsyncRequestState();

            // You can also specify additional header values like
            // the user agent or the referer:
            WebRequestObject.UserAgent = ".NET Framework/2.0";
            WebRequestObject.Referer   = "http://prconserver.phogue.net";
            //WebRequestObject.KeepAlive = false;

            // Set values for the request back
            WebRequestObject.Method      = "POST";
            WebRequestObject.ContentType = "application/x-www-form-urlencoded";
            WebRequestObject.Proxy       = null;

            //arsPostData.WebRequest = WebRequestObject;

            SAsyncRequestState sarState = new SAsyncRequestState();

            sarState.uscAccounts = this;
            sarState.WebRequest  = WebRequestObject;

            IAsyncResult iarResult = WebRequestObject.BeginGetRequestStream(new AsyncCallback(PortCheckPostCallback), sarState);

            // Set a timeout on our Request for a stream.  Timeout in 20 seconds.
            ThreadPool.RegisterWaitForSingleObject(iarResult.AsyncWaitHandle, new WaitOrTimerCallback(PortCheckTimeoutCallback), sarState, 15000, true);
        }
Ejemplo n.º 2
0
        public void PortCheck(string strUrl) {

            this.OnPortCheckerFeedback("checking");

            // Open a connection
            HttpWebRequest WebRequestObject = (HttpWebRequest)HttpWebRequest.Create(strUrl);
            //SAsyncRequestState arsPostData = new SAsyncRequestState();

            // You can also specify additional header values like 
            // the user agent or the referer:
            WebRequestObject.UserAgent = ".NET Framework/2.0";
            WebRequestObject.Referer = "http://prconserver.phogue.net";
            //WebRequestObject.KeepAlive = false;

            // Set values for the request back 
            WebRequestObject.Method = "POST";
            WebRequestObject.ContentType = "application/x-www-form-urlencoded";
            WebRequestObject.Proxy = null;

            //arsPostData.WebRequest = WebRequestObject;

            SAsyncRequestState sarState = new SAsyncRequestState();
            sarState.uscAccounts = this;
            sarState.WebRequest = WebRequestObject;

            IAsyncResult iarResult = WebRequestObject.BeginGetRequestStream(new AsyncCallback(PortCheckPostCallback), sarState);

            // Set a timeout on our Request for a stream.  Timeout in 20 seconds.
            ThreadPool.RegisterWaitForSingleObject(iarResult.AsyncWaitHandle, new WaitOrTimerCallback(PortCheckTimeoutCallback), sarState, 15000, true);
        }