c# - The connection to the remote server can not be established -


i want download file windows server 2012 r2 local computer. file path: e:\update.

i tried code:

string localpath = @"c:\update\"; string filename = "update.xml";  try {     var requestfiledownload = (ftpwebrequest)webrequest.create("ftp://111.111.111.111/e:/update/" + filename);     requestfiledownload.method = webrequestmethods.ftp.downloadfile;      ftpwebresponse responsefiledownload = (ftpwebresponse)requestfiledownload.getresponse();      using (stream responsestream = responsefiledownload.getresponsestream())     {         using (filestream writestream = new filestream(localpath + filename, filemode.create))         {             int length = 2048;             byte[] buffer = new byte[length];             int bytesread = responsestream.read(buffer, 0, length);              while (bytesread > 0)             {                 writestream.write(buffer, 0, bytesread);                 bytesread = responsestream.read(buffer, 0, length);             }         }     }             system.windows.forms.messagebox.show("downloaded..." ); } catch (exception ex1) {     system.windows.forms.messagebox.show("downloading error..."+ex1.message); } 

but error

the connection remote server can not established.

what can cause error message?


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -