I have a small program that keep posting some data (4MB) to remote server. Each time when an internal 4MB buffer is full, I create a new HttpWebRequest
, call BeginGetRequestStream
/EndGetRequestStream
, write data to stream, close it, and done. Because I don't care about response, so I didn't call GetResponse
/BeginGetResponse
/EndGetResponse
.
My question is, since HttpWebRequest
doesn't have a Close
method, is it safe to leave current HttpWebRequest
instance behind? If I didn't do anything to that HttpWebRequest
, will the connection be automatically closed? If answer is no, how to explicitly close current HTTP connection? Thanks.