How to set port for webclient in c#?

淺唱寂寞╮ 提交于 2019-12-24 07:03:02

问题


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?


回答1:


set the url as http://www.website.com:20114/folder/file.ext




回答2:


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);


来源:https://stackoverflow.com/questions/995495/how-to-set-port-for-webclient-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!