简体   繁体   English

如何使用C#Windows Phone 7 WebClient发送和接收二进制数据?

[英]How to send and receive binary data using C# Windows Phone 7 WebClient?

Speaking as concisely as possible: What is involved in sending and receiving binary data via the WebClient class in Windows Phone 7, using HTTP POST? 讲得尽可能简洁:使用HTTP POST通过Windows Phone 7中的WebClient类发送和接收二进制数据涉及什么? Is WebClient the correct class to use? WebClient是正确使用的类吗?

Currently, I am trying to call OpenReadAsync() inside an OpenWriteCompleted event handler after writing the request binary data. 当前,我试图在写入请求二进制数据后在OpenWriteCompleted事件处理程序中调用OpenReadAsync()。 The request data is being written on an asynchronous result to OpenWriteAsync(). 请求数据正在异步结果上写入OpenWriteAsync()。 I am doing this for the purpose of sending and receiving Protocol Buffer data encoded using ProtoBuf-Net, to a http URI. 我这样做是为了将使用ProtoBuf-Net编码的协议缓冲区数据发送和接收到http URI。

Any help would be appreciated! 任何帮助,将不胜感激!

Thanks, 谢谢,

Nick 缺口

You have to implement POST (FILES) yourself. 您必须自己实现POST(文件)。

But check out this: 但是检查一下:

http://mytoolkit.codeplex.com/wikipage?title=Http http://mytoolkit.codeplex.com/wikipage?title=Http

(simple POST, GZIP, etc.) (简单的POST,GZIP等)

WebClient appears to be the wrong class to use. WebClient似乎是使用错误的类。 I am now using HttpWebRequest with great results. 我现在正在使用HttpWebRequest,效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM