HttpClientEndGetRequestStream Method |
Supply the stream interface
Namespace: Crestron.SimplSharp.Net.HttpAssembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntaxpublic Stream EndGetRequestStream(
HttpClientRequest aRequest,
Object user
)
Parameters
- aRequest HttpClientRequest
- The Http request object
- user Object
- User defined object
Return Value
StreamThe Input Stream
Exceptions
RemarksYou must set the value of the ContentLength property before EndGetRequestStream.
Example
Example Request Handler CallBack
private static void GetRequestStreamCallback(HttpClientRequest asynchronousResult, HTTP_CALLBACK_ERROR error, object status)
{
HttpRequest request = asynchronousResult;
Console.WriteLine("Please enter the input data to be posted:");
string postData = Console.ReadLine();
// Convert the string into a byte array.
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
//Last chance for headers going out
request.Header.ContentType = "text/html";
request.Header.AddHeader(new HttpHeader("Content-Length", postData.Length.ToString()));
// End the request operation
Stream postStream = request..ThisClient.EndGetRequestStream(asynchronousResult);
// Write to the request stream.
postStream.Write(byteArray, 0, postData.Length);
postStream.Close();
// Start the asynchronous operation to get the response.
request.BeginGetResponse(new HTTPStreamResponseCallbackEx(GetResponseCallback), request, status);
}
Version Information
.NET
Supported in: 6.0
.NET Compact Framework
Supported in: 3.5
See Also