I have sftp server. and when I upload file(SSH_FXP_WRITE) to server(I did it with filezilla client), if the file is bigger than window size, after I send the Window_Adjust_Message, I get 1 or 2 messages of junk data that I can't parse to legal sftp message.
// Ssh library get data on chanel after authontication
OnData(byte[] data)
{
AdjustWindowMessage((uint) data.Length);
// Send to sftp subsystem to parse and handle request
HandleData(data);
}
AdjustWindowMessage(uint messageLength)
{
SWindowSize -= messageLength;
if(SWindowSize <= SMaxSize)
{
connection.session.SendMessage(new WindowAdjustMessage
{
ResChannel = ClientId;
BytesToAdd = SInitWindowSize;
});
SWindowSize = SInitWindowSize;
}
}
regular packet size is about 16000 bytes, and 1 or 2 packets that I get after I send the adjust message, is smaller but not always the same size. What is those messages and how shuld I handle it
I didn't figure out if it's buffer of the temp data that has left before I send the adjust message. But I can see, that the first bytes (that from there I have to get the size) is very big.
I saw similar problem but without solution that someone else ask before.