void ProcessMsg::composeMsg() { connectToCASA(); // outputs the STOC and STOC data block composeStoc(); openlog("mid", LOG_PID, LOG_AUTH); vectordataField = _appMID->dataFieldGet(); vector::const_iterator fIter; cout << "\n\nThis is the primary data block. ProcessMsg \n\n"; // outputs the primary data block for (fIter = dataField.begin(); fIter != dataField.end(); fIter++) { vectorfileInfo = (*fIter)->fileNamesGet(); vector::iterator infoIter; for (infoIter = fileInfo.begin(); infoIter != fileInfo.end(); infoIter++) { _ptocTb.clear(); composePtoc((*fIter), (*infoIter)); int counter = 0; int bufferSize = (_lastPage + 1) * 256; unsigned char buffer[bufferSize]; memset(buffer, '\0', bufferSize); map, string > >:: const_iterator cIter; for (cIter = _ptocTb.begin(); cIter != _ptocTb.end(); cIter++) { buffer[counter] = cIter->second.first.first; counter++; buffer[counter] = cIter->second.first.second; counter++; } for (cIter = _stocTb.begin(); cIter != _stocTb.end(); cIter++) { buffer[counter] = cIter->second.first.first; counter++; buffer[counter] = cIter->second.first.second; counter++; } for (cIter = _stocTb.begin(); cIter != _stocTb.end(); cIter++) { const string data = cIter->second.second; for (int index = 0; index < data.size(); index++) { buffer[counter] = data[index]; counter++; } } for (cIter = _ptocTb.begin(); cIter != _ptocTb.end(); cIter++) { const string data = cIter->second.second; if (cIter->first < SOURCE) { continue; } else if (cIter->first == SOURCE) { unsigned int connectId = _inOutFile->connectIdGet(); buffer[counter] = connectId / 256; counter++; buffer[counter] = connectId % 256; counter++; } else { for (int index = 0; index < data.size(); index++) { buffer[counter] = data[index]; counter++; } } } int returnSize; if ((returnSize = send(_sock, &buffer, bufferSize, 0)) != bufferSize) { cout<<"Error sending message to CASA. "<<__FILE__<<" "<<__LINE__<(echoBuffer[index])<<":"; } else { testStr = testStr + static_cast(echoBuffer[index]); cout<(echoBuffer[index]); } } cout<<"\n\nPlease identify this string of zeroes\n\n"; cout<