c# - Why does httpWebRequest.GetResponse() timeout when stream is not used? -


i ran strange behavior understand. reading image via httpwebrequest. following code raises timeout exception:

httpwebrequest httpwebrequest = (httpwebrequest)httpwebrequest.create(url); httpwebrequest.timeout = 5000; httpwebresponse httpwebreponse = (httpwebresponse)httpwebrequest.getresponse(); stream stream = httpwebreponse.getresponsestream(); 

please note stream not used anywhere else afterwards. however, if add following line:

image image = image.fromstream(stream); 

also here note image not used anywhere later on. can explain why timeout in first case?


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -