Click here to Skip to main content
15,887,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Strange Compiler behavior Pin
Richard MacCutchan1-May-15 22:43
mveRichard MacCutchan1-May-15 22:43 
AnswerRe: Strange Compiler behavior Pin
ForNow2-May-15 15:12
ForNow2-May-15 15:12 
GeneralRe: Strange Compiler behavior Pin
Richard MacCutchan2-May-15 20:50
mveRichard MacCutchan2-May-15 20:50 
GeneralRe: Strange Compiler behavior Pin
ForNow2-May-15 21:05
ForNow2-May-15 21:05 
QuestionCWinThread::CAsyncSocket::Create issues Pin
ForNow28-Apr-15 4:52
ForNow28-Apr-15 4:52 
AnswerCode works in CWInThread constructer ? Pin
ForNow29-Apr-15 6:03
ForNow29-Apr-15 6:03 
GeneralRe: Code works in CWInThread constructer ? Pin
Albert Holguin1-May-15 4:40
professionalAlbert Holguin1-May-15 4:40 
GeneralRe: Code works in CWInThread constructer ? Pin
ForNow1-May-15 6:16
ForNow1-May-15 6:16 
Hi
I have a loop in my CWinApp::Initinstance where I create 4 Derived CWinThreads
a derived CAsyncSocket class is a protected member
When I step into with the debugger to the CasyncSocket::create it takes a wild which is in the CWinThread::Initinstance it takes a branch out the CWinThread::Initinstance back to the loop as if there some sort of exception I tried a try { around the code but it didn't go to the catch it just jumped out of the CWinThread::Initinstance back to the loop

C++
         for (i = 0, start_port = 11007; i < 4; start_port++, i++)
           {

           threadptr[i] = new SockCLeintThread(start_port);

           if (threadptr[i] == NULL)
               AfxMessageBox((LPCTSTR)"SockClientThreadFail",NULL,MB_ICONERROR);

            ret = threadptr[i]->CreateThread(CREATE_SUSPENDED);
                      if(ret == 0)
                         errcd = GetLastError();

// 
             threadptr[i]->flags.is_connected = 0;
             threadptr[i]->flags.busy = 0;
             threadptr[i]->ResumeThread();
C++
BOOL SockCLeintThread::InitInstance
{
    AfxSocketInit();
//        ipaddr = "192.168.1.4";
    // thisocket(myport); 
     ipaddr = (LPCTSTR)"10.0.0.205";    

                 if(thisocket.Create(thisocket.port,SOCK_STREAM,(FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE),ipaddr)== 0)
          {
                          error_code =  thisocket.GetLastError();
                   }

     DWORD value;
     BOOL val, return_code;
     const void *valptr = &val;
      thisocket.AsyncSelect(FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE); // request notifications
     val = 1;
     return_code = thisocket.SetSockOpt(SO_KEEPALIVE,valptr,sizeof(BOOL));//
     val = 1;
    return_code = thisocket.SetSockOpt(SO_OOBINLINE,valptr,sizeof(BOOL));
     value = 1;
     return_code = thisocket.IOCtl(FIONBIO,&value);
     return_code = thisocket.IOCtl(FIONREAD,&value);
     return_code = thisocket.IOCtl(SIOCATMARK,&value);
                  sockbuffer = new TCHAR[100];

}

When I move this code to the SockCLientThread constructor it works
Questionswscanf_s White Space Help Pin
Jesuaw28-Apr-15 4:09
Jesuaw28-Apr-15 4:09 
AnswerRe: swscanf_s White Space Help Pin
k505428-Apr-15 5:41
mvek505428-Apr-15 5:41 
GeneralRe: swscanf_s White Space Help Pin
Jesuaw28-Apr-15 6:50
Jesuaw28-Apr-15 6:50 
GeneralRe: swscanf_s White Space Help Pin
k505428-Apr-15 7:05
mvek505428-Apr-15 7:05 
GeneralRe: swscanf_s White Space Help Pin
Jesuaw28-Apr-15 7:49
Jesuaw28-Apr-15 7:49 
QuestionMapViewOfFIle in Client and Server returning 2 different address Pin
ForNow24-Apr-15 11:40
ForNow24-Apr-15 11:40 
AnswerRe: MapViewOfFIle in Client and Server returning 2 different address Pin
Richard Andrew x6424-Apr-15 12:06
professionalRichard Andrew x6424-Apr-15 12:06 
GeneralRe: MapViewOfFIle in Client and Server returning 2 different address Pin
ForNow24-Apr-15 12:31
ForNow24-Apr-15 12:31 
AnswerRe: MapViewOfFIle in Client and Server returning 2 different address Pin
Frankie-C25-Apr-15 7:37
Frankie-C25-Apr-15 7:37 
GeneralRe: MapViewOfFIle in Client and Server returning 2 different address Pin
ForNow25-Apr-15 15:09
ForNow25-Apr-15 15:09 
QuestionInterProcess communication questions Pin
ForNow24-Apr-15 8:44
ForNow24-Apr-15 8:44 
AnswerRe: InterProcess communication questions Pin
Frankie-C25-Apr-15 7:35
Frankie-C25-Apr-15 7:35 
GeneralRe: InterProcess communication questions Pin
ForNow25-Apr-15 15:08
ForNow25-Apr-15 15:08 
QuestionSynchronizing access to data Pin
ramonlarodo22-Apr-15 21:55
ramonlarodo22-Apr-15 21:55 
QuestionRe: Synchronizing access to data Pin
Richard MacCutchan22-Apr-15 23:25
mveRichard MacCutchan22-Apr-15 23:25 
QuestionCDateTimeCtrl editing short year format Pin
baerten22-Apr-15 21:51
baerten22-Apr-15 21:51 
QuestionRe: CDateTimeCtrl editing short year format Pin
Richard MacCutchan22-Apr-15 23:23
mveRichard MacCutchan22-Apr-15 23:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.