【问题标题】:How to set port for webclient in c#?如何在 C# 中为 webclient 设置端口?
【发布时间】:2010-11-02 23:43:52
【问题描述】:

我正在尝试使用 c# 中的 webclient 下载文件。

文件位置的远程端口是20114。如何告诉webclient使用20114端口?

【问题讨论】:

    标签: c# webclient port


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      我的自发猜测(没有尝试过)会简单地将其包含在 url 中:

      WebClient client = new WebClient();
      client.DownloadFile(@"http://host:20114/file.ext", localFilename);
      

      【讨论】:

        猜你喜欢
        • 2019-12-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-05-25
        • 2014-07-04
        • 1970-01-01
        • 2022-10-20
        • 2012-09-01
        相关资源
        最近更新 更多