小编Ann*_*mus的帖子

C# - httpWebRequest 流的大小是否有限制?

我正在尝试构建一个应用程序,使用 httpwebrequests 从自定义网络服务器下载一个小二进制文件(20-25 KB)。

这是服务器端代码:

Stream UpdateRequest = context.Request.InputStream;
byte[] UpdateContent = new byte[context.Request.ContentLength64];
UpdateRequest.Read(UpdateContent, 0, UpdateContent.Length);
String remoteVersion = "";
for (int i = 0;i < UpdateContent.Length;i++) { //check if update is necessary
    remoteVersion += (char)UpdateContent[i];
}

byte[] UpdateRequestResponse;

if (remoteVersion == remotePluginVersion) {
    UpdateRequestResponse = new byte[1];
    UpdateRequestResponse[0] = 0; //respond with a single byte set to 0 if no update is required
} else {
    FileInfo info = new FileInfo(Path.Combine(Directory.GetCurrentDirectory(), "remote logs", "PointAwarder.dll"));
    UpdateRequestResponse = File.ReadAllBytes(Path.Combine(Directory.GetCurrentDirectory(), "remote …
Run Code Online (Sandbox Code Playgroud)

.net c# http httpwebrequest httpwebresponse

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

.net ×1

c# ×1

http ×1

httpwebrequest ×1

httpwebresponse ×1