Re: Why it can not work after I delete breakpoint.(attach the CSocketFile object to a CArchive)
Despite any breakpoints in or out. This is
hard to develop socket implementation
with the use of breakpoints... Like Joseph
said, timings are wrong...
My own code do the following way.. and
work very well.
void CMyOwnSocket::OnReceive(int nErrorCode)
{
// At least, check if something goes wrong with sub system..
if(nErrorCode == WSAENETDOWN)
{
// Up to you to behave on this..
}
// I do the process I need before calling the CSocket::OnReceive
method..
static BYTE localbuffer[10000];
int lgtoreceive = 5000; // or some calculation to
know how many bytes to receive..
int lgreceive = Receive(&localbuffer, lgtoreceive); // Acquire the
data..
// Up to you the way to handle the received data..
// .. at last, call the base class implementation... This is a way MSDN
suggest to do.. somewhere
CSocket::OnReceive(nErrorCode)
}
... But there are other ways to handle sockets...
jmarc...
"zjs" <makefriend8@hotmail.com> wrote in message
news:uZHBlePCJHA.4176@TK2MSFTNGP04.phx.gbl...
class CChatSocket : public CSocket
{
...
}
void CChatSocket::OnReceive(int nErrorCode)
{
CSocket::OnReceive(nErrorCode);//Here I insert a breakpoint,
m_pDoc->ProcessPendingRead();
}
It works well if I insert a breakpoint int the CHATTER (Client). but If I
delete that breakpoint, OnReceive function can not receive anything.(of
course CHATSRVR have the breakpoint too.the onlye changing is breakpoint)
the source code is in MSDN (CHATTER and CHATSRVR)