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. General Programming
  3. C / C++ / MFC
  4. Application Error The Exception BreakPoint

Application Error The Exception BreakPoint

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmindebugginghelplounge
3 Posts 2 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.
  • S Offline
    S Offline
    shivditya
    wrote on last edited by
    #1

    A task infront of me is to develop local chat server which will just accept data from everyone and pass it to person whom it is to be send. Server compiles fine but as soon as I run it ,it fails. Errors come at Accept statement. The requirement is due to internet is not allowed. And way for instant communication is required as comapany layout is very complecated to reach from one room to other. Official mail is too inconvenient for small messages. //CSocket cs,cr[500]; defined in h file // bool connected; BOOL CChatserverDlg::OnInitDialog() { CDialog::OnInitDialog(); --------------- ------------------ ---------------- count = 0; connected = false; connected = cs.Create(4000,SOCK_STREAM); SilentWork(); return TRUE; } void CChatserverDlg::SilentWork() { bool check = false; check = cs.Listen(); for(int i = 0;i < 500;i++) //even I reduce number error comes { AfxBeginThread(&thread,0); count++; } } UINT thread(LPVOID p) { CChatserverDlg* dlg = (CChatserverDlg*)AfxGetApp()->GetMainWnd(); SOCKADDR* lpSockAddr; dlg->cs.Accept(dlg->cr[count],lpSockAddr ); while(dlg->connected) { ULONG nBytesToReceive=0; DWORD dwErr; if( !dlg->cr[count].IOCtl(FIONREAD, &nBytesToReceive)) { dwErr = WSAGetLastError(); } if( nBytesToReceive==0 ) { } else { char* buff = new char[15]; try { dlg->cr[count].Receive(buff,15,0); } catch(CException e) { } dlg->m_ldList1.AddString(buff); char* data = new char[1024]; bool continueloop = true; do { ULONG ToReceive=0; if( !dlg->cr[count].IOCtl(FIONREAD, &ToReceive)) { dwErr = WSAGetLastError(); } if( ToReceive==0 ) { } else { dlg->cr[count].Receive(data,1023,0); dlg->cr[count].SendTo(data,1023,4000,buff,0); if(NULL != strstr("diconnected",data)) continueloop = false; } }while(continueloop);

    || ART OF LIVING ||

    D 1 Reply Last reply
    0
    • S shivditya

      A task infront of me is to develop local chat server which will just accept data from everyone and pass it to person whom it is to be send. Server compiles fine but as soon as I run it ,it fails. Errors come at Accept statement. The requirement is due to internet is not allowed. And way for instant communication is required as comapany layout is very complecated to reach from one room to other. Official mail is too inconvenient for small messages. //CSocket cs,cr[500]; defined in h file // bool connected; BOOL CChatserverDlg::OnInitDialog() { CDialog::OnInitDialog(); --------------- ------------------ ---------------- count = 0; connected = false; connected = cs.Create(4000,SOCK_STREAM); SilentWork(); return TRUE; } void CChatserverDlg::SilentWork() { bool check = false; check = cs.Listen(); for(int i = 0;i < 500;i++) //even I reduce number error comes { AfxBeginThread(&thread,0); count++; } } UINT thread(LPVOID p) { CChatserverDlg* dlg = (CChatserverDlg*)AfxGetApp()->GetMainWnd(); SOCKADDR* lpSockAddr; dlg->cs.Accept(dlg->cr[count],lpSockAddr ); while(dlg->connected) { ULONG nBytesToReceive=0; DWORD dwErr; if( !dlg->cr[count].IOCtl(FIONREAD, &nBytesToReceive)) { dwErr = WSAGetLastError(); } if( nBytesToReceive==0 ) { } else { char* buff = new char[15]; try { dlg->cr[count].Receive(buff,15,0); } catch(CException e) { } dlg->m_ldList1.AddString(buff); char* data = new char[1024]; bool continueloop = true; do { ULONG ToReceive=0; if( !dlg->cr[count].IOCtl(FIONREAD, &ToReceive)) { dwErr = WSAGetLastError(); } if( ToReceive==0 ) { } else { dlg->cr[count].Receive(data,1023,0); dlg->cr[count].SendTo(data,1023,4000,buff,0); if(NULL != strstr("diconnected",data)) continueloop = false; } }while(continueloop);

      || ART OF LIVING ||

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      shivditya wrote:

      Server compiles fine but as soon as I run it ,it fails. Errors come at Accept statement.

      Have you stepped into this code to determine why?

      shivditya wrote:

      And way for instant communication is required as comapany...

      Are other IM packages against company policy?


      "A good athlete is the result of a good and worthy opponent." - David Crow

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      S 1 Reply Last reply
      0
      • D David Crow

        shivditya wrote:

        Server compiles fine but as soon as I run it ,it fails. Errors come at Accept statement.

        Have you stepped into this code to determine why?

        shivditya wrote:

        And way for instant communication is required as comapany...

        Are other IM packages against company policy?


        "A good athlete is the result of a good and worthy opponent." - David Crow

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        S Offline
        S Offline
        shivditya
        wrote on last edited by
        #3

        Some old people running company are against any software which is not having name of company on caption.

        || ART OF LIVING ||

        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