我在这里使用 msdn 示例:http: //msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx
我将 FileStream 更改为 MemoryStream 并且它不读取字节
当我将它改回 FileStream 时,它工作正常。
有什么线索吗?
谢谢
CompressMemoryStream();
Stream requestStream = _request.EndGetRequestStream(ar);
const int bufferLength = 2048;
byte[] buffer = new byte[bufferLength];
int count = 0;
int readBytes = 0;
do
{
//MemoryStream _compressedOutStream
//is created/filled by 'CompressMemoryStream()'
readBytes = _compressedOutStream.Read(buffer, 0, bufferLength);
requestStream.Write(buffer, 0, readBytes);
count += readBytes;
}
while (readBytes != 0);
requestStream.Close();
state.Request.BeginGetResponse(
new AsyncCallback(EndGetResponseCallback),
state
);