Hi, I am trying to upload a file to the FTP server, from another C# application: System.IO.Stream _Stream = _FtpWebRequest.GetRequestStream(); but I always get this error: "The remote server returned an error: (220) 220 Password ok, FTP server ready" This is not an error, but only a message. Could you please help me? Thank you!
ReplyIs this code licensed for use under any particular license? (GNU, Berkley, PHP, etc)
ReplyMainform.cs method MessageHandler_Message line 198 I get a cross threaded exception. I fixed it this way... Can also use the check m_listBoxMessages.InvokeRequired .... private void MessageHandler_Message(int nId, string sMessage) { try { m_listBoxMessages.BeginUpdate(); int nItem = m_listBoxMessages.Items.Add(string.Format("({0}) {2}", nId, System.DateTime.Now, sMessage)); if (m_listBoxMessages.Items.Count 5000) { m_listBoxMessages.Items.RemoveAt(0); } if (m_listBoxMessages.SelectedIndex
ReplyAppendCommandHandler.cs - line 39
original:
while (nReceived > 0)
{
nReceived = socketReply.Receive(abData);
file.Write(abData, nReceived);
}
fixed:
while (nReceived > 0)
{
file.Write(abData, nReceived);
nReceived = socketReply.Receive(abData);
}
Reply
The problem is m_apConnections.Count, because it is in the for weather, and it's not fixed. for each handler.Stop() it is decrased for one, so we have situation to remove only half of opened connections.
public void Stop()
{
for (int nConnection = 0 ; nConnection < m_apConnections.Count; nConnection++)
{
FtpSocketHandler handler = m_apConnections[nConnection] as FtpSocketHandler;
handler.Stop();
}
m_socketListen.Stop();
m_theThread.Join();
}
one possible solution:
public void Stop()
{
for (int connCnt = m_apConnections.Count - 1; connCnt >= 0; connCnt--)
{
FtpSocketHandler handler = m_apConnections[connCnt] as FtpSocketHandler;
handler.Stop();
}
m_socketListen.Stop();
m_theThread.Join();
}
Reply
How do you compile these dlls... plz help.
Open the solution file in the app folder (csftp.sln), let visual studio convert it and then just build.
ReplyHi Darwen I just read ur article n downloaded ur code n I really wanted to tell u that its a great article and helped me a lot. I was wondering if u cud also come uo with something about changing the permission of the files on the server. Thanks and Regards Krishnendu Mukherjee
ReplyJasny i przejrzysty kod serwera FTP, najlepszy jaki znalazEem w necie. Thanks darwen.
ReplyIn this program,whether choose an item to remove a user,it will show messagebox ,is it a little error?I correct it as follow:
private void m_buttonRemoveUser_Click(object sender, System.EventArgs e)
{
if (m_listViewUsers.SelectedItems.Count == 0)
{
MessageBox.Show("Please select a user in the list", "CSFtp");
}
else
{
for (int nIndex = 0 ; nIndex < m_listViewUsers.SelectedItems.Count ; nIndex++)
{
ListViewItem item = m_listViewUsers.SelectedItems[nIndex];
string sUser = item.SubItems[0].Text;
Assemblies.Ftp.UserData.Get().RemoveUser(sUser);
m_listViewUsers.Items.Remove(item);
}
}
}
Reply
The Assemblies.General C++.NET dll has now been removed and replaced with a C# assembly with full source. Also the problem with localhost connection has been addressed (thanks jgorlick).
Reply