RE: Problem faced while using Native WLAN API.



Vista or XP?

--PA


"marimuthu.pesit@xxxxxxxxx" wrote:
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

  • 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 ... my Laptop ... But this issue doesnt arise if i plug and unplug the external WiFi ...
    (microsoft.public.win32.programmer.networks)
  • Re: Using a Hercules HWGUSB2-54-V2 wifi usb adapter
    ... I'm trying to use this usb wifi adapter. ... Try adding a macro for the correct device ID to ... product GUILLEMOT HWGUSB254 0xe000 HWGUSB2-54 WLAN ... HWGUSB2-54-V2 WLAN ...
    (freebsd-questions)
  • Re: XP-Home - Druckprobleme aus MS-Dos-Programmen
    ... Offensichtlich gibt es ein Probem zwischen LPT1 und WLAN. ... mal im Bios "Plug & Play-OS = no" einstellen und dann nach einem neuen ... Versuch, der Kram runterzuschmeißen. ...
    (microsoft.public.de.german.windowsxp.hardware)
  • FC3 ipw 2200 WLan on Thinkpad R51
    ... I have problems getting my WLan authenticated. ... Hardware Manager but i can´t activate it. ... If i plug in my ELSA Airlancer ...
    (alt.os.linux.redhat)