windowsMobile利用C#将文件上传到FTP服务器,无法建立socket连接?
我要做一个程序,将图片上传的FTP服务器。
开发环境:windowsMobile 利用C#
将文件上传到FTP服务器主要参考网上的 http://blog.csdn.net/wenshengwang/archive/2007/11/22/1898169.aspx
利用FTPClient类实现文件上传。
经测试在winform环境下可以上传,但是到windowsMobile环境下居然连socket都connect不上。
(请高手给看看,怎么回事?? )
代码如下:
private void btnUpfile_Click(object sender, EventArgs e)
{
JerryClass.FTPClient ftpC = new JerryClass.FTPClient();
ftpC.FtpJinduEvent += new JerryClass.FTPClient.dFtpJindu(ftpC_FtpJinduEvent);
ftpC.RemoteHost = "192.168.1.8";
ftpC.RemotePort = 21;
ftpC.RemoteUser = "FTPuser";
ftpC.RemotePass = "FTPpassword";
ftpC.RemotePath = "";
if(openFileDialog1.ShowDialog()==DialogResult.OK)
{
string sFile = openFileDialog1.FileName;
try
{
ftpC.Connect();// 连接FTP Server 这里出毛病 但是在WinForm上没问题
ftpC.Put(sFile); // 上传单个文件
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}