NS_IMETHODIMP FCGXStream::GetEnvVar(nsACString &name, nsACString &value) { RecvString(name); RecvString(value); return mFD != INVALID_SOCKET ? NS_OK : NS_ERROR_ABORT; }
nsresult FCGXStream::GetHeader(nsACString &name, nsACString &value) { RecvString(name); RecvString(value); return mFD != INVALID_SOCKET ? NS_OK : NS_ERROR_ABORT; }
void IUpperLayer::OnReceive(const apl::byte_t* apData, size_t aNumBytes) { if(this->LogReceive()) { LOG_BLOCK(LEV_COMM, RecvString() << " " << toHex(apData, aNumBytes, true)); } this->_OnReceive(apData, aNumBytes); //call the implementation }
bool CSocket::RecvString( string& sValue ) { sValue.clear(); char szReceiveBuffer[MAX_RETRIEVED_DATA_LEN]; return RecvString( szReceiveBuffer, MAX_RETRIEVED_DATA_LEN - 1 ) && ( sValue.assign( szReceiveBuffer, m_nBytesRead ).length() != 0 ); }
std::vector<std::string> s13WXWServer::RecvString () { std::vector<std::string> aryReturn; unsigned int uiSocketsLength = aryClientSockets.size (); aryReceivedFrom.clear (); for (unsigned int uiIdx = 0; uiIdx < uiSocketsLength; uiIdx++) { std::string strString = RecvString (aryClientSockets.at (uiIdx)); aryReturn.push_back (strString); aryReceivedFrom.push_back (uiIdx); } return (aryReturn); }
std::vector<char *> s13WXWServer::RecvString (int iLength) { std::vector<char *> aryReturn; unsigned int uiSocketsLength = aryClientSockets.size (); aryReceivedFrom.clear (); for (unsigned int uiIdx = 0; uiIdx < uiSocketsLength; uiIdx++) { char *cString = RecvString (aryClientSockets.at (uiIdx), (iLength + 1)); aryReturn.push_back (cString); aryReceivedFrom.push_back (uiIdx); } return (aryReturn); }
LRESULT CLearnWorldServerDlg::DatabaseManage(WPARAM wParam, LPARAM lParam) { CString Command; if (WSAGETSELECTERROR(lParam)) { // Display the error and close the socket closesocket(wParam); } switch (WSAGETSELECTEVENT(lParam)) { case FD_ACCEPT: { ClientSocket[NumberOfClient] = accept(wParam, NULL, NULL); NumberOfClient++; break; } case FD_READ: { int post = -1, dpos = -1; for (int i = 0; i<NumberOfClient; i++) { if (ClientSocket[i] == wParam) { if (i<NumberOfClient) post = i; } } CString strResult[2]; CString temp; if (RecvString(wParam, temp) < 0) break; SplitFlag(temp, strResult); int flag = _ttoi(strResult[0]); switch (flag) { case -1 : // Logout OnSignOut(wParam, strResult[1]); break; case 0://Login OnSignIn(wParam ,strResult[1]); break; case 1://Register OnRegister(wParam, strResult[1]); SaveData(); break; case 2://Forgot password OnForgotPass(wParam, strResult[1]); SaveData(); break; case 3:// Edit Information OnEditInfo(wParam, strResult[1]); SaveData(); break; case 4: // Add Teacher OnAddTeacher(wParam,strResult[1]); SaveData(); break; case 13: // Search Teacher OnSearchTeacher(wParam, strResult[1]); break; case 14: // Search User OnSearchUser(wParam, strResult[1]); break; case 15: // Get user list to create table OnCreateTable(wParam, strResult[1]); break; case 16: // Search Username for Delete / Deactivated / Activate OnSearchAccount(wParam, strResult[1]); break; case 17: // Delete Account OnDeleteAccount(wParam, strResult[1]); SaveData(); break; case 18: // Deactivate Account OnDeactivateAccount(wParam, strResult[1]); SaveData(); break; case 19: // Activate Account OnActivateAccount(wParam, strResult[1]); SaveData(); break; case 20: //Rate teacher OnEvaluateTeacher(wParam, strResult[1]); break; } break; } case FD_CLOSE: { //MessageBox(L"Client closed connection", NULL, MB_OK); UpdateData(); int post = -1; for (int i = 0; i<NumberOfClient; i++) { if (ClientSocket[i] == wParam) { if (i<NumberOfClient) post = i; } } closesocket(wParam); for (int j = post; j < NumberOfClient; j++) { ClientSocket[post] = ClientSocket[post + 1]; } NumberOfClient--; UpdateData(FALSE); if (NumberOfClient == 0); break; } } return 0; }