Problem faced while using Native WLAN API.
- From: marimuthu.pesit@xxxxxxxxx
- Date: 1 Mar 2007 22:22:20 -0800
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;
.
- Follow-Ups:
- RE: Problem faced while using Native WLAN API.
- From: Pavel A.
- Re: Problem faced while using Native WLAN API.
- From: Yi Lu [MSFT]
- RE: Problem faced while using Native WLAN API.
- Prev by Date: Enable/Disable DHCP on adapter
- Next by Date: TCP transmission problem
- Previous by thread: Enable/Disable DHCP on adapter
- Next by thread: Re: Problem faced while using Native WLAN API.
- Index(es):
Relevant Pages
|