Bit/Win Ce

pda 소켓 프로그래밍시

생각처럼 2012. 2. 3. 21:24

CCesocket 클래스를 상속하여 소켓을 생성하였더니

Csocket 으로 상속하였을때는 안되던 이벤트들이 먹히기 시작했다 신기하다....

ce 프로그래밍시 소켓클래스는 CCesocket 클래스를 상속해야만 하는건가??

 

void CSocket_C::OnReceive(int nErrorCode) 
{
 // TODO: Add your specialized code here and/or call the base class
 
 ((CClientApp*)AfxGetApp())->ReceiveData(); // 데이터를 읽는다.
 CAsyncSocket::OnReceive(nErrorCode);
}

 

 

void CClientApp::ReceiveData()
{
 char temp[1000];
 CString strText;
 client_s->Receive(temp, sizeof(temp));

 UINT    nPort;
 client_s->GetPeerName(strText, nPort); // 상대방의 IP 주소와 포트 번호 얻음
 strText = "[ " + strText + " ] " + temp;
 //((CListBox*)m_pMainWnd->GetDlgItem(IDC_CLIST))->InsertString(-1, strText);
 //CClientDlg* mf = (CClientDlg*)::AfxGetMainWnd();
 //mf->m_list = temp;
 ((CEdit*)m_pMainWnd->GetDlgItem(IDC_CLIST))->ReplaceSel(strText,TRUE);
}