caprogrammer
May 25th, 2008, 10:28 PM
I have been trying to fix this problem for the past few days, but to no avail.
I subclassed from CAsyncSocket and implemented OnConnect, OnSend, OnReceive and OnClose. On the most past, everything worked well for a file transfer. However, more often than not, when a file transfer was about to complete, my application received an OnClose call before the last block of data was received, which came in in a final (sometimes a couple of calls) OnReceive call right after the OnClose call. And this would complete the transfer. I looked over the internet and tried to find example codes and msdn documentation and they all closed the sockets and stuff and assumed it would be the end in their OnClose handlers. And intuitively, that's how I expected things to work. Question: Is OnClose always the very last call not followed by any OnReceive's? My concern is that a bug in my code may be causing this "unexpected" behavior.
Thanks in advance.
I subclassed from CAsyncSocket and implemented OnConnect, OnSend, OnReceive and OnClose. On the most past, everything worked well for a file transfer. However, more often than not, when a file transfer was about to complete, my application received an OnClose call before the last block of data was received, which came in in a final (sometimes a couple of calls) OnReceive call right after the OnClose call. And this would complete the transfer. I looked over the internet and tried to find example codes and msdn documentation and they all closed the sockets and stuff and assumed it would be the end in their OnClose handlers. And intuitively, that's how I expected things to work. Question: Is OnClose always the very last call not followed by any OnReceive's? My concern is that a bug in my code may be causing this "unexpected" behavior.
Thanks in advance.