The operation has timed-out. (9999)

Topics: User Forum
Feb 20, 2008 at 3:59 AM
Hallo... I just got the FlickrNet api and was trying my first hello world'ish program -- just the first example from http://blogs.msdn.com/coding4fun/archive/2006/11/22/1126978.aspx, searching for pics with the tag "microsoft".

I downloaded and compiled the source code with no problems. I have my key. I can create the flickr object just fine. Whenever I try to USE the flickr object, I get
the exception "The operation has timed-out. (9999)"

Just for kicks, I downloaded the pre-compiled .dll files and I get the same errors.

Specifically, it's on the line "Photos microsoftPhotos = flickr.PhotosSearch(searchOptions);"
I've also tried doing a people search, same issue.
I've gone to the URL and the XML file pops up in firefox just fine.

I'm sure I've forgotten something painfully obvious or some such, but I cannot figure out what. Can anybody help? Thanks!
Matt
Feb 20, 2008 at 4:18 AM
Oh, further info...
VS.NET 2003
.NET 1.1 framework

The source: (key is a static string with the correct key, it works when I use the URL which contains the key)

flickr = new Flickr(key);

Console.WriteLine("Searching for microsoft photos");

PhotoSearchOptions searchOptions = new PhotoSearchOptions();
searchOptions.Tags = "microsoft";
Photos microsoftPhotos = flickr.PhotosSearch(searchOptions); //bang crash, timeout happens here

Console.WriteLine("{0} photos", microsoftPhotos.TotalPhotos);
Coordinator
Feb 20, 2008 at 2:09 PM
Is it possible you are behind a proxy server?
Feb 20, 2008 at 7:29 PM
I hadn't even thought of that, but no, no proxy. It's a NAT address but there's no http proxy involved... Unless the ISP has some sort of invisible proxy setup, but I don't think that's it. I've written other apps to gather stock data from yahoo.com pages and those work without a hitch.

I ran the program again today and I have the same 9999 exception.
Feb 20, 2008 at 7:39 PM
Just for kicks, I made a function in the same class that uses HttpWebRequest and HttpWebResponse to pull the URL

http://api.flickr.com/services/rest/?accuracy=16&api_key=mykeyblahblahblah&method=flickr.photos.search&tags=microsoft

Literally, it's just
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
Stream resStream = response.GetResponseStream();

It pulls the XML page just fine. I haven't dug into the source of the flickrNet dll enough to know how it's trying to get the info....
Feb 21, 2008 at 6:55 AM
Edited Feb 21, 2008 at 6:57 AM
Flickr.cs --> private string DoGetResponse(string url, string variables)
That's the function it's timing out in.

The problem seems to stem from this line:
req.Method = CurrentService==SupportedService.Zooomr?"GET":"POST";

That would set the req.Method to "POST" since it's not using Zoomr. But the URL is created like a get URL, isnt it? Am I missing something? That seems to be what's causing it to timeout, though...

I commented out that one line and it works just fine...
Coordinator
Feb 21, 2008 at 8:55 AM
Changing that is fine for lots of the methods (e.g. photos.search etc) but for all of the update methods (e.g. photos.setMeta) the method must be a post.

I have had timeout errors before, but never needed to make this change to get things to work, so there must be something different between our systems.

Can you try changing it back to the old code but adding the following line in your code before calling the PhotoSearch() method.

ServicePointManager.Expect100Continue = false;
Feb 21, 2008 at 7:38 PM
Okay, I tried that and I still get the same timeout, in the same place.

In my case, I'm only interested in retrieving data from flickr, not uploading, so GET probably will work fine for me. I'd be happy to try out any other suggestions you come up with though. :-)