Problem faced while using Native WLAN API.



Hi,
In my application, I am making use of native WLAN api's.
The problem arises when I plug and unplug my WiFi adapter connected to
my Laptop (I dont have a build in WiFi adapter in my laptop)
continously for about 5 to 6 times,
the function WlanOpenHandle( ) return a error code 1220 which is
ERROR_REMOTE_SESSION_LIMIT_EXCEEDED "An attempt was made to establish
a session to a network server, but there are already too many sessions
established to that server." as mentioned in MSDN.
But this issue doesnt arise if i plug and unplug the external WiFi
adapter once or twice.
I have attached the code for your reference.
Please give me a solution.


BOOL CWireless::EnumDevices(ALL_DEVICE_INFO & pDeviceInfo)
{
ODS("CWireless::EnumDevices");
PWLAN_INTERFACE_INFO_LIST pAvailableInterfaces = NULL;
DWORD dwErrorCode = ERROR_SUCCESS;
HANDLE hClientHdl = NULL;
DWORD dwVersion = 0;
pDeviceInfo.NoOfDevices = 0;

try
{
if ((dwError = WlanOpenHandle(WLAN_API_VERSION, NULL, // reserved
&dwVersion, &hClientHdl)) == ERROR_SUCCESS)
{

WlanEnumInterfaces(hClientHdl, NULL, &pAvailableInterfaces);
// This could happen if the WLAN Auto Config service is stopped
if(NULL == pAvailableInterfaces)
{
ODS("GetEnumDevices failed");
LogMessageInfo(WL_INFORMATION, "Wireless interfaces not
available", NULL, NULL, NULL);
//close handle
WlanCloseHandle(hClientHdl,
NULL // reserved
);
return FALSE;
}
if(pAvailableInterfaces->dwNumberOfItems >0)
{
CString strInterface;
pDeviceInfo.NoOfDevices = pAvailableInterfaces->dwNumberOfItems;
for (int nCount=0;nCount<pAvailableInterfaces-
dwNumberOfItems;nCount++)
{
strInterface = pAvailableInterfaces-
InterfaceInfo[nCount].strInterfaceDescription;
strcpy(pDeviceInfo.chAdaptersName[nCount] , strInterface);
}

// Free all memory allocated by Wlan APIs
WlanFreeMemory(pAvailableInterfaces);
WlanCloseHandle(hClientHdl,
NULL // reserved
);

hClientHdl = NULL;
pAvailableInterfaces = NULL;
}

}
else
{
// Free all memory allocated by Wlan APIs
WlanFreeMemory(pAvailableInterfaces);
WlanCloseHandle(hClientHdl,
NULL // reserved
);
ODS("GetEnumDevices failed");
return FALSE;
}

return TRUE;

}
catch(...)
{
ODS("Exception at CWireless::EnumDevices");
}
return FALSE;

.



Relevant Pages

  • RE: Problem faced while using Native WLAN API.
    ... I am making use of native WLAN api's. ... The problem arises when I plug and unplug my WiFi adapter connected to ... But this issue doesnt arise if i plug and unplug the external WiFi ...
    (microsoft.public.win32.programmer.networks)
  • Nach Anschluß ans Firmennetz ging daheim nix mehr
    ... Da ich in der Firma kein WLAN habe, ... Kaum war das Laptop wieder daheim, ... Der Suchdienst konnte keine Serverliste vom Hauptsuchdienst ...
    (microsoft.public.de.german.windowsxp.networking)
  • Re: Laptop USA
    ... ins Internet kommt. ... bezueglich offenener kostenloser Wlan-Zugaenge nicht klagen. ... Laptop nur kleiner;-) ... meist auch per Wlan angeschaltet) stehen das die Gaeste kostenlos zum ...
    (de.rec.reisen.misc)
  • Re: Completely OT, but need help!
    ... and which has been connecting wirelessly to my Linksys WAG160N router ... without problem since I purchased the laptop last September. ... I have gone into device manager and checked the WLAN which is working ... I have connected my laptop directly to the router via cable to send this ...
    (uk.legal)
  • Re: Wie muß AccessPoint konfiguriert werden
    ... Es gibt einen WLAN Router und einen Laptop. ... zugleassene Client per MAC: ...
    (microsoft.public.de.german.windowsxp.networking)