views:

53

answers:

0

I'm trying to download a response from a server wich is in Protocol Buffer format from a Windows Phone 7 application.

I'm trying to do this with a WebClient, my problem is the following.

The WebClient has only two method for downloading

DownloadStringAsync(new Uri(url));

and

OpenReadAsync(new Uri(url));

but this two method are not good to retrieve the response because, the response size should have 16 hexadecimal caracteres ( 080118CBDDF0E104 ), but the size of the string and the stream get by the two methods are only 8.

So I'm searching a way to resolve my problem. I found one for C#

public static T DownloadProto<T>(this WebClient client, string address)
{
   byte[] data = client.DownloadData(address);
   using (var ms = new MemoryStream(data))
   {
      return Serializer.Deserialize<T>(ms);
   }
}

on http://code.google.com/p/protobuf-net/source/browse/trunk/BasicHttp/HttpClient/ProtoWebClient.cs?spec=svn340&amp;r=340

But this method was deleted or not yet implemented on the Windows Phone 7 development kit.