This project has moved and is read-only. For the latest updates, please go here.

Exception - Underlying connection was closed

Topics: Developer Forum
Feb 7, 2008 at 11:40 PM
After I download a photo from the large URL, I added calls to get some info about the photo:

mFlickr.PhotosGetExif(photo.PhotoId, photo.Secret);
mFlickr.PhotosGetInfo(photo.PhotoId, photo.Secret);

The first time I ran it, PhotosGetSizes threw an exception. The second time I ran my program, PhotosGetExif threw it. In both case, the exception is:

"Caught an exception calling (method name here): FlickrNet.FlickrWebException: The underlying connection was lost: A connection that was expected to be kept alive was closed by the server. -->System.Net.WebException: (ditto). "

The call stack from the inner exception is :

at System.Net.HttpWebRequest.GetResponse()
at FlickrNet.Flickr.DoGetResponse(String url, String variables)

Why would the server close down the connection? Is there anything I can to do re-connect if I get this exception....does just retrying the call attempt to re-establish the connection?


Feb 11, 2008 at 10:29 AM
I have a lot of difficulty reproducing this error.

Can you try adding the following line of code to the Flickr.DoGetResponse() method, just after the KeepAlive = false line:


Does this fix the problem?
Feb 14, 2008 at 1:04 AM
I have been pulled away from this task for a few days. Just downloaded your code and will get back into it and let you know. Thanks!