ashishchoure 9 Junior Poster

Hi,

I am using CArchive class to transfer file in my chat application . The problem is that when i send data through CArchive write and flush, the CArchive Read gets hang in last transmission. I've gone through msdn http://support.microsoft.com/kb/192704. it is telling that it requires one more flush or close the connected socket to come out receiver from Read. I did that but for only in case of closing socket it is working but receiver is getting some more garbage bytes in received buffer.

where i am doing wrong?
here is my code for sending file ...

do
{		
	dwRead = File.Read(buffer, SEND_BUFFER_SIZE);
	
	m_ptrArIn->Write(buffer, dwRead);
	m_ptrArIn->Flush();	

	// Make buffer empty
	memset(buffer,NULL,SEND_BUFFER_SIZE);
}
while (dwRead > 0);