HttpClientEndGetResponseStream Method |
Ends an asynchronous request to an Internet resource
Namespace: Crestron.SimplSharp.Net.HttpAssembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntaxpublic HttpClientResponse EndGetResponseStream(
HttpClientRequest aRequest
)
Parameters
- aRequest HttpClientRequest
- HttpClientRequest
Return Value
HttpClientResponseA WebResponse that contains the response from the Internet resource.
Exceptions
RemarksThe 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
private static void GetResponseCallback(HttpClientRequest asynchronousResult,HTTP_CALLBACK_ERROR error, object status)
{
StreamReader streamRead;
string responseString;
Stream streamResponse;
HttpClientRequest request = asynchronousResult;
HttpClientResponse response = request.ThisClient.EndGetResponseStream(request);
if (response.HasContentLength)
{
streamResponse = response.ContentStream;
streamRead = new StreamReader(streamResponse);
responseString = streamRead.ReadToEnd();
Console.WriteLine(responseString);
streamResponse.Close();
streamRead.Close();
}
response.Dispose();
}Version Information
.NET
Supported in: 6.0
.NET Compact Framework
Supported in: 3.5
See Also