Click or drag to resize

HttpClientEndGetResponseStream Method

Ends an asynchronous request to an Internet resource

Namespace: Crestron.SimplSharp.Net.Http
Assembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntax
C#
public HttpClientResponse EndGetResponseStream(
	HttpClientRequest aRequest
)

Parameters

aRequest  HttpClientRequest
HttpClientRequest

Return Value

HttpClientResponse
A WebResponse that contains the response from the Internet resource.
Exceptions
ExceptionCondition
ArgumentNullExceptionaRequest is NULL
InvalidOperationExceptionNo BeginRequest
Remarks
The EndGetResponse method completes an asynchronous request for an Internet resource that was started by calling the BeginGetResponse method. Note: You must call the Close method to close the stream and release the connection. Failure to do so may cause your application to run out of connections.
Example
C#
// Example Response Handler CallBack
private static void GetResponseCallback(HttpClientRequest asynchronousResult,HTTP_CALLBACK_ERROR error, object status)
{
    StreamReader streamRead;
    string responseString;
    Stream streamResponse;
    HttpClientRequest request = asynchronousResult;

    // End the response
    HttpClientResponse response = request.ThisClient.EndGetResponseStream(request);
    if (response.HasContentLength)
    {
        streamResponse = response.ContentStream;
        streamRead = new StreamReader(streamResponse);
        responseString = streamRead.ReadToEnd();
        Console.WriteLine(responseString);
        // Close the stream object
        streamResponse.Close();
        streamRead.Close();
    }
   // Release the HttpResponse
   response.Dispose();
}

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also