Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. CSocket EVC++ 3.0 problem. please help

CSocket EVC++ 3.0 problem. please help

Scheduled Pinned Locked Moved Mobile
helpc++
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ripsi
    wrote on last edited by
    #1

    Hi I have a weird problem that I cannot seem to figure out. It has to do with adding an OnReceive() event in a derived CSocket class. The problem is that even though I add the virtual function OnReceived into the derived class and call my main form the event won't fire. If I map a read buffer function (when I know there is data waiting to be received) I can the buffer, however, I am unable to get the event to fire. here is the virtual function: void MySocket::OnReceive(int nErrorCode) { if(nErrorCode == 0){ ((CSmartPDADlg*)m_pWnd)->onreceive(); //((CSmartPDADlg*)m_pWnd)->WriteLog(L"RECEIVE"); } CSocket::OnReceive(nErrorCode); } Even if I put a break in the following function, it never gets called even thought it is receiving data. The onreceive() event in the main class is as follows: void CSmartPDADlg::onreceive(){ char *buff = new char[512] ; int size = 512 ; int recd ; CString recdstr ; recd = clientSocket.Receive(buff, size ) ; //m_log.SetWindowText((LPCTSTR)"HERE"); if ( recd == SOCKET_ERROR ) { MessageBox( L"Error in receive ", NULL, MB_OK); } else { buff[recd] = NULL ; recdstr = buff ; //recdstr. WriteLog(recdstr); //GetProtocolTokens(recdstr); UpdateData ( FALSE ) ; } } If anyone has ran into the problem in having EVC++ 3.0 not firing CSocket OnReceive events please advise. Any help would be appreciated. Thanks! Thanh

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups