The information in this article applies to:
SYMPTOMSWhen reading data that uses CArchive::Read and the file is a CSocketFile, certain buffer sizes and data sizes are more likely to cause a hang in CSocket::Receive at the end of transmission when the transmission isn't closed. CAUSECArchive sometimes tries to maintain data in its buffer even if all of the data requested has been read. This causes an extra CSocketFile::Read call when no data is available on the socket file. The Read call hangs until more data appears or until the socket connection is closed. RESOLUTIONThe underlying socket of the socket file should be closed at the end of transmitting the data. STATUSThis behavior is by design. MORE INFORMATION
CArchive provides a buffered mechanism to read data from a file, which can
be based on CSocketFile as well as CFile. The algorithm for CArchive::Read
is implemented so that an extra call to a CFile derived class (for example,
CSocketFile) Read function is made even if all of the needed data is
present. For disk-based files, this presents no problem because EOF is
reached and the call to Read returns immediately. For CsocketFile-based
files, either the socket must be closed or more data needs to be sent for
the Read call to return. Additional query words: Write hangs CAsyncSocket
Keywords : kbMFC kbVC kbVC210 kbVC220 kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 kbWinsock |
Last Reviewed: August 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |