WlanConnect not working

Discussion in 'Wireless Networking' started by hari, May 1, 2009.

  1. hari

    hari Guest

    Hi all,

    I am trying to use WlanConnect to a connect to a ad-hoc network. I am
    getting the error invalid parameter.

    I know the ssid of the ad-hoc network and wanna connect to it using the ssid
    and not the profile name. It is an unsecure network. I found samples on the
    net to connect to wifi network using the profile name and tat works for me..
    but I want to connect using the SSID...

    Here is the code

    WLAN_CONNECTION_PARAMETERS wlanConnPara;

    // set the connection mode
    wlanConnPara.wlanConnectionMode = wlan_connection_mode_discovery_unsecure;

    // set the profile name
    wlanConnPara.strProfile = NULL;

    // set the SSID
    DOT11_SSID Ssid={0};
    string strSsid = "harinetwork";
    Ssid.uSSIDLength = (ULONG)strSsid.size();
    memcpy(&Ssid.ucSSID, strSsid.c_str(), strSsid.size());

    wlanConnPara.pDot11Ssid = &Ssid;

    wlanConnPara.dot11BssType = dot11_BSS_type_independent;

    // the desired BSSID list is empty
    wlanConnPara.pDesiredBssidList = NULL;

    // no connection flags
    wlanConnPara.dwFlags = 0;

    if((error = WlanConnect(hClient,&guid,&wlanConnPara,NULL)) == ERROR_SUCCESS)
    {
    cout<<"Done"<<endl;
    }
    else
    {
    cout<<"error "<<error<<endl;
    }
     
    hari, May 1, 2009
    #1
    1. Advertising

  2. Hi
    Knowing the SSID of Ad-Hoc Network does not mean that you can connect to
    it.
    There can be other element that are needed to configure, and in some cases
    that can be a None computer device that you can not connect to at all.
    Jack (MS, MVP-Networking)

    "hari" <> wrote in message
    news:...
    > Hi all,
    >
    > I am trying to use WlanConnect to a connect to a ad-hoc network. I am
    > getting the error invalid parameter.
    >
    > I know the ssid of the ad-hoc network and wanna connect to it using the
    > ssid
    > and not the profile name. It is an unsecure network. I found samples on
    > the
    > net to connect to wifi network using the profile name and tat works for
    > me..
    > but I want to connect using the SSID...
    >
    > Here is the code
    >
    > WLAN_CONNECTION_PARAMETERS wlanConnPara;
    >
    > // set the connection mode
    > wlanConnPara.wlanConnectionMode = wlan_connection_mode_discovery_unsecure;
    >
    > // set the profile name
    > wlanConnPara.strProfile = NULL;
    >
    > // set the SSID
    > DOT11_SSID Ssid={0};
    > string strSsid = "harinetwork";
    > Ssid.uSSIDLength = (ULONG)strSsid.size();
    > memcpy(&Ssid.ucSSID, strSsid.c_str(), strSsid.size());
    >
    > wlanConnPara.pDot11Ssid = &Ssid;
    >
    > wlanConnPara.dot11BssType = dot11_BSS_type_independent;
    >
    > // the desired BSSID list is empty
    > wlanConnPara.pDesiredBssidList = NULL;
    >
    > // no connection flags
    > wlanConnPara.dwFlags = 0;
    >
    > if((error = WlanConnect(hClient,&guid,&wlanConnPara,NULL)) ==
    > ERROR_SUCCESS)
    > {
    > cout<<"Done"<<endl;
    > }
    > else
    > {
    > cout<<"error "<<error<<endl;
    > }
     
    Jack [MVP-Networking], May 2, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RHJhZ29ueA==?=

    wifi not working on new hp, or not working after live update

    =?Utf-8?B?RHJhZ29ueA==?=, Oct 2, 2005, in forum: Wireless Networking
    Replies:
    1
    Views:
    1,000
    =?Utf-8?B?RHJhZ29ueA==?=
    Oct 2, 2005
  2. Taki Soho
    Replies:
    0
    Views:
    1,964
    Taki Soho
    Sep 22, 2004
  3. mmmarlee mcgarvey
    Replies:
    1
    Views:
    937
    Watcher of the Skies
    Sep 2, 2004
  4. dominolog

    Native WIFI SDK - Windows XP SP2 - WlanConnect problem

    dominolog, May 8, 2007, in forum: Wireless Networking
    Replies:
    2
    Views:
    3,085
    Yi Lu [MSFT]
    May 10, 2007
  5. problems with WlanConnect()

    , May 19, 2008, in forum: Wireless Networking
    Replies:
    4
    Views:
    1,668
Loading...

Share This Page