FTP 服务器的安装和配置方法FTP 客户端的开发方法
#region 与服务器的交互
// 创建FTP连接
private FtpWebRequest CreateFtpWebRequest(string uri, string requestMethod) {
FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(uri); request.Credentials = networkCredential; request.KeepAlive = true; http://www.77cn.com.cneBinary = true; request.Method = requestMethod; return request; }
// 获取服务器返回的响应体
private FtpWebResponse GetFtpResponse(FtpWebRequest request) {
FtpWebResponse response = null; try {
response = (FtpWebResponse)request.GetResponse(); lstbxFtpState.Items.Add("验证完毕,服务器回应信息:[" + response.WelcomeMessage + "]");
lstbxFtpState.Items.Add("正在连接:[ " + response.BannerMessage + "]"); lstbxFtpState.TopIndex = lstbxFtpState.Items.Count - 1; return response; }
catch (WebException ex) {
lstbxFtpState.Items.Add("发送错误。返回信息为:" + ex.Status); lstbxFtpState.TopIndex = lstbxFtpState.Items.Count - 1; return null; } }
#endregion
#region 登陆模块的实现 //登陆服务器事件
private void btnlogin_Click(object sender, EventArgs e) {
if (tbxServerIp.Text == string.Empty) {
MessageBox.Show("请先填写服务器IP地址", "提示"); return; }
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库网络协议的实现与应用实训报告(17)在线全文阅读。
相关推荐: