StrangerInBeijing
Mar 20th, 2007, 02:09 AM
I got this class that deal with all FTP functionality, and must admit, I dont know much how it work. I basically just edited it a bit for my own use, and seems to work fine.
Before I have been on a shared Win2K host, and the FTP functionality worked fine. But now we moved to a Win2K3 Dedicated server (yes, FTP to a remote server), this problem start occuring after FTP'in a few files up. It work for a while, then start with this error:
An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in system.dll
Additional information: An existing connection was forcibly closed by the remote host
The error occur on the line that reads:
in this code: clientSocket.Send(cmdBytes, cmdBytes.Length, 0);
private void sendCommand(String command)
{
Byte[] cmdBytes = Encoding.ASCII.GetBytes((command+"\r\n").ToCharArray());
clientSocket.Send(cmdBytes, cmdBytes.Length, 0);
readReply();
}
I attached the class I am using. For those looking for ftp functionality in their c# application, feel free to use it. Works (oops...worked) like a bomb for me.
Before I have been on a shared Win2K host, and the FTP functionality worked fine. But now we moved to a Win2K3 Dedicated server (yes, FTP to a remote server), this problem start occuring after FTP'in a few files up. It work for a while, then start with this error:
An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in system.dll
Additional information: An existing connection was forcibly closed by the remote host
The error occur on the line that reads:
in this code: clientSocket.Send(cmdBytes, cmdBytes.Length, 0);
private void sendCommand(String command)
{
Byte[] cmdBytes = Encoding.ASCII.GetBytes((command+"\r\n").ToCharArray());
clientSocket.Send(cmdBytes, cmdBytes.Length, 0);
readReply();
}
I attached the class I am using. For those looking for ftp functionality in their c# application, feel free to use it. Works (oops...worked) like a bomb for me.