News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Miscellaneous Forum
 
proxysocket can't download and upload file from Ftp site

Reply

by Adward [bigbom at tom dot com]
posted on 2004/06/22

I used the proxysocket class to visit Ftp site. I can connect the site, but can't download and upload file. In my code:
public void download(string remoteFileName,string localFileName,ref string resultInfo)
{
...
TcpListener conn = new TcpListener(IPAddress.Any,Port());
conn.Start();
...
SendLine(m_pClient,"PASV mode");
reply = ReadLine(m_pClient);
...
SendLine(m_pClient,"RETR " + remoteFileName);
reply = ReadLine(m_pClient);
...
long startTime = DateTime.Now.Ticks;
while(!conn.Pending())
{
System.Threading.Thread.Sleep(50);
if((DateTime.Now.Ticks - startTime) / 10000 > 20000)
{
resultInfo = "Ftp server no response";
return;
}
}
using(Socket connectedFtpServer = conn.AcceptSocket())
{
conn.Stop();
int count = 1;
while(count > 0)
{
byte[] data = new Byte[1024];
count = connectedFtpServer.Receive(data,data.Length,SocketFlags.None);
output.Write(data,0,count);
output.Flush();
}
...
}
}
Help me thanks.

by Adward [bigbom at tom dot com]
posted on 2004/06/22
Reply

my e-mail: bigbom@tom.com

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.