Back when the .NET Framework 1.0 was launched, there were no good FTP client implementations for .NET, so I wrote my own implementation using System.Net.Socket. Recently, I had to make some changes, and during debugging I noticed distorted output from the IIS 5.1 FTP server that I tested (WinXP SP 2) when closing the connection.
The connection is as follows:
Send: QUIT<CRLF> Receive: 221<CRLF><NUL>?<ETX><NUL> (socket closed)
The FTP server channel handler is line oriented using CRLF as a terminator, and after receiving four bytes after the first CRLF, it expects a second CRLF that causes a timeout error. The whole sequence is returned with a single socket read operation, and I have verified that the byte count returned from the socket is correct.
This byte sequence was compatible with this server, and I was wondering if this is expected / can be prevented, or if I just try to "fix it quickly" by adding it to my list of "MS FTP Server Privileges".
source share