远程C/S模式下,文件传输!! 服务端生成的xml文件放在一个date的临时文件夹中,文件夹一般不会大于20M,然后现在要考虑网络状态的好坏,以及多线程的情况.客户端将这个文件夹下载到本地目录system下.下载完。发送socket命令(这个不用实现)删除服务端的那个临时文件夹请教下服务端和客户端如何写代码.传输方式指定为ftp的模式. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 那就自己直接实现下FTP客户端 服务器端用FTP服务端软件 [code=C#]Cursor currentCursor = this.Cursor; FtpWebResponse response = null; Stream stream = null; try { this.Cursor = Cursors.WaitCursor; //Create the FtpWebRequest object FtpWebRequest request = (FtpWebRequest)WebRequest.Create(textBoxServer.Text); request.Credentials = new NetworkCredential(textBoxUserName.Text, textBoxPassword.Text); request.Method = WebRequestMethods.Ftp.ListDirectory; //Send the request to the server response = (FtpWebResponse)request.GetResponse(); //read the response and fill the list box stream = response.GetResponseStream(); FillDirectoryList(stream); serverDirectory = null; buttonOpenDirectory.Enabled = false; buttonGetFile.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error FTP Client", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (response != null) response.Close(); if (stream != null) stream.Close(); this.Cursor = currentCursor; }[code]借用一下《c#入门基础》书上的一个例子。以上是主要代码。 参考C# WinForm开发系列 - Socket/WCF/Rometing/Web Services 看一下这个错误 查询SYBASE数据中文出乱码 请教C#的三层架构的编写思路 win DataGrid 怎样修改数据,它和绑定的DataSet不同步? 如何判断一个 string 中是否含有小数点"." 如何从SQL Server2000将Image类型导出为图片文件? C#串口接收数据异常 MAMM这哥们当年也遇到这问题了,但是没说怎么解决的 页面先后显示 Remoting如何实现多个文件传输至外网的服务器上? 函数执行结果返回类型 请教,请教,c#登陆对话框怎么写? 求端口映射的编程逻辑
FtpWebResponse response = null;
Stream stream = null;
try
{
this.Cursor = Cursors.WaitCursor; //Create the FtpWebRequest object
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(textBoxServer.Text);
request.Credentials = new NetworkCredential(textBoxUserName.Text, textBoxPassword.Text);
request.Method = WebRequestMethods.Ftp.ListDirectory; //Send the request to the server
response = (FtpWebResponse)request.GetResponse(); //read the response and fill the list box
stream = response.GetResponseStream();
FillDirectoryList(stream); serverDirectory = null;
buttonOpenDirectory.Enabled = false;
buttonGetFile.Enabled = false;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error FTP Client", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
if (response != null)
response.Close();
if (stream != null)
stream.Close();
this.Cursor = currentCursor;
}[code]
借用一下《c#入门基础》书上的一个例子。
以上是主要代码。