olin
March 6th, 2004, 01:24 PM
I want to use socket to send and receive data with a website.
I created my own CMySocket derived from CSocket, and overrided the OnSend and OnReceive methods:
void CMySocket::OnReceive(int nErrorCode)
{
char strRecv[1024];
Receive(strRecv, 1024);
}
void CClickSocket::OnSend(int nErrorCode)
{
Send("Get", 3);
AsyncSelect(FD_READ);
}
then I used the this socket in one of document member function:
m_pSocket = new CMySocket(this);
m_pSocket->CAsyncSocket::Create()
m_pSocket->Connect(szIP, 80)
But when I ran program, only the OnSend function executed. The OnReceive function doesn't run at all (I've set a break to check it).
Why??
I created my own CMySocket derived from CSocket, and overrided the OnSend and OnReceive methods:
void CMySocket::OnReceive(int nErrorCode)
{
char strRecv[1024];
Receive(strRecv, 1024);
}
void CClickSocket::OnSend(int nErrorCode)
{
Send("Get", 3);
AsyncSelect(FD_READ);
}
then I used the this socket in one of document member function:
m_pSocket = new CMySocket(this);
m_pSocket->CAsyncSocket::Create()
m_pSocket->Connect(szIP, 80)
But when I ran program, only the OnSend function executed. The OnReceive function doesn't run at all (I've set a break to check it).
Why??