Networking Question Help

This is a discussion on Networking Question Help within the Networking/Device Communication forums, part of the General Programming Boards category; I need someone who willing to help me to explain some scripts of C++ code, its all about networking, acquiring ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    4

    Networking Question Help

    I need someone who willing to help me to explain some scripts of C++ code, its all about networking, acquiring data from access point by snmp query and using WRAPI library. I used few weeks to study the codes line by line, but still cant really get to understand of it. Kinda slow progress. So i need your help. Please.

    Thank you thank you.

  2. #2
    Registered User
    Join Date
    Apr 2007
    Posts
    4
    Code:
    // Retrieve All Available APs
    void CWlanAPInfo::getAvailableAPs(CStringArray * pAvailableAPs)
    {
    	// Remove old array content
    	pAvailableAPs->RemoveAll();
    
        IEnumWbemClassObject * pEnum = NULL;
        IWbemClassObject * pObject = NULL;
        ULONG ulCount;
    	HRESULT hRes;
        VARIANT var;
        VariantInit(&var);
    
    	hRes = wmiConnection.pSvc->CreateInstanceEnum(L"MSNdis_80211_BSSIList",
    		WBEM_FLAG_FORWARD_ONLY,
    		NULL,
    		&pEnum);
    
    	if (pEnum->Next(WBEM_INFINITE, 1, &pObject, &ulCount) == S_OK)
    	{
    		// retrieve process identifier
            VariantClear(&var);
    
    		CComVariant variantSSIDList;
    
    		hRes = pObject->Get(L"Ndis80211BSSIList", 0, &variantSSIDList, 0, 0);
    		if (!FAILED(hRes) && (variantSSIDList.vt != VT_NULL))
    		{
    			HRESULT hr = S_OK;
    			// Calculate the number of elements    
    			long lUpper = 0;
    			long lLower = 0;
    			hr = SafeArrayGetUBound(V_ARRAY(&variantSSIDList), 1, &lUpper);
    			hr = SafeArrayGetLBound(V_ARRAY(&variantSSIDList), 1, &lLower);
    
    			long lNumOfElems = lUpper - lLower + 1;
    
    		    // Gain access to the SAFEARRAY
    			LPUNKNOWN HUGEP *punkArray = 0;
    			hr = SafeArrayAccessData(V_ARRAY(&variantSSIDList), 
    				(void**)&punkArray);
    
    			for (int nIndex = 0; nIndex < lNumOfElems; nIndex++)
    			{
    				CComQIPtr<IWbemClassObject> spSummaryObject = 
    					punkArray[nIndex];
    
    				_variant_t varSsId;
    				_variant_t varSsIdLength;
    				_variant_t varRssi;
    				varSsId.Clear();
    				varSsIdLength.Clear();
    				varRssi.Clear();
    				hr = spSummaryObject->Get(CComBSTR(_T("Ndis80211SsId")), 0,
    					&varSsId, 0, 0);
    				hr = spSummaryObject->Get(CComBSTR(_T("Ndis80211SsIdLength")), 0,
    					&varSsIdLength, 0, 0);
    //				hr = spSummaryObject->Get(CComBSTR(_T("Ndis80211Rssi")), 0,
    //					&varRssi, 0, 0);
    
    				CString SsId;
    				for (int x=0; x<varSsIdLength.lVal; x++)
    				{
    					SsId.Insert(x, (CHAR) *((char *)varSsId.parray->pvData + x));
    				}
    				pAvailableAPs->Add(SsId);	// Add the SSID into array
    			}
    			hr = SafeArrayUnaccessData(V_ARRAY(&variantSSIDList));
    		}
    	}
    }
    i not understand how this works.... can any1 here teach me??

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 01:14 PM
  2. networking comfirmation
    By rEtard in forum Networking/Device Communication
    Replies: 1
    Last Post: 07-20-2005, 04:59 PM
  3. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 10:47 PM
  4. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM
  5. Beyond MFC : COM || Networking
    By kuphryn in forum Windows Programming
    Replies: 5
    Last Post: 04-25-2002, 05:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21