Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).

ORT instead of PORT

no avatar
User

chendric@yahoo.com

ORT instead of PORT

by chendric@yahoo.com » Wed Mar 17, 2004 12:54 am

Hi guys, I love your FTP client. I'm using the .Net version in a C# application and think I might have found a bug. Every now and then, when I'm in active mode, the FTP client sends "ORT" to the server when it should send "PORT". I think it happens when the port number chosen by the client is too high. Here are a couple examples:

PORT 151,205,169,246,96,63 (works fine)
ORT 141,157,238,53,19,156 (no good)

I think the problem is in here:

private void SetDataPort(IPEndPoint ep)
{
byte[] hostBytes =BitConverter.GetBytes(ep.Address.Address);
byte[] portBytes = ToByteArray((ushort)ep.Port);

// assemble the PORT command
string cmd = new StringBuilder("PORT ").
Append((short)hostBytes[0]).Append(",").
Append((short)hostBytes[1]).Append(",").
Append((short)hostBytes[2]).Append(",").
Append((short)hostBytes[3]).Append(",").
Append((short)portBytes[0]).Append(",").
Append((short)portBytes[1]).ToString();

// send command and check reply
string reply = SendCommand(cmd);
ValidateReply(reply, "200");

/*
//byte[] hostBytes = ep.Address.GetAddressBytes();

string host = ep.Address.ToString();
System.Console.WriteLine("host="+host);
string byte1=host.Substring(0,host.IndexOf("."));
System.Console.WriteLine("byte1="+byte1);
host=host.Substring(host.IndexOf(".")+1);
System.Console.WriteLine("byte1="+byte1);

string byte2=host.Substring(0,host.IndexOf("."));
host=host.Substring(host.IndexOf(".")+1);
System.Console.WriteLine("byte2="+byte2);

string byte3=host.Substring(0,host.IndexOf("."));
host=host.Substring(host.IndexOf(".")+1);
System.Console.WriteLine("byte3="+byte3);

string byte4=host.Substring(0,host.Length);
System.Console.WriteLine("byte4="+byte4);

byte[] portBytes = ToByteArray((ushort)ep.Port);

string cmd = new StringBuilder("PORT ").
Append(byte1).Append(",").
Append(byte2).Append(",").
Append(byte3).Append(",").
Append(byte4).Append(",").
Append((short)portBytes[0]).Append(",").
Append((short)portBytes[1]).ToString();

// send command and check reply
string reply = SendCommand(cmd);
ValidateReply(reply, "200");
*/
}
no avatar
User

bruce

Re: ORT instead of PORT

by bruce » Wed Mar 17, 2004 1:00 am

Thanks for pointing this out - we'll take a look. We hope to release a new version soon so we'll try to sort this out before that happens.
no avatar
User

chendric@yahoo.com

not so sure

by chendric@yahoo.com » Wed Mar 17, 2004 1:00 am

I'm not sure that this problem is caused by a high port anymore because I've not seen this on my ftp server.

[2] Tue 16Mar04 00:12:22 - (000717) ORT 141,157,238,53,19,154
[2] Tue 16Mar04 00:12:22 - (000717) PORT 141,157,238,53,19,155
[2] Tue 16Mar04 00:12:22 - (000717) APPE 004003112004131752ApplicationLog.txt

Anby ideas why this might happen?
no avatar
User

chendric@yahoo.com

oops

by chendric@yahoo.com » Thu Mar 18, 2004 12:07 am

I meant to say that I'm not sure that this is related to a high port number anymore because I now see ORT messages on my FTP server for port numbers lower than other messages where the PORT message is properly constructed. For instance:

[2] Tue 16Mar04 00:12:22 - (000717) ORT 141,157,238,53,19,154
[2] Tue 16Mar04 00:12:22 - (000717) PORT 141,157,238,53,19,155
[2] Tue 16Mar04 00:12:22 - (000717) APPE 004003112004131752ApplicationLog.txt

Thanks for any thoughts on this,

Colin
no avatar
User

bruce

Re: oops

by bruce » Thu Mar 18, 2004 12:44 am

no avatar
User

chendric@yahoo.com

Solved

by chendric@yahoo.com » Wed Apr 07, 2004 11:43 pm


Who is online

Users browsing this forum: No registered users and 33 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron