Application Error The Exception BreakPoint
-
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 ||
-
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 ||
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
-
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