How to set port for webclient in c#?

2019-07-25 02:09发布

I am trying to download a file using webclient in c#.

the remote port of the file location is 20114. How do I tell webclient to use 20114 port?

2条回答
欢心
2楼-- · 2019-07-25 02:47
迷人小祖宗
3楼-- · 2019-07-25 02:59

My spontaneous guess (without having tried it) would be to simply include it in the url:

WebClient client = new WebClient();
client.DownloadFile(@"http://host:20114/file.ext", localFilename);
查看更多
登录 后发表回答