Re: how to connect other PCs/PPCs via 802.11

From: compulim (123)
Date: 06/30/04


Date: Wed, 30 Jun 2004 13:05:47 +0800

There are no ways to search devices with WiFi. Unlike Bluetooth, WiFi forms
a network, Bluetooth forms peer connections. In Ethernet, there's no way to
search for a device neither.

Apart from forming network and security, WiFi is just an Ethernet
over-the-air. So use WinSock library to do it as you would do in Ethernet.

Compulim

"Eric" <eric.yun@meta4hand.com> wrote in message
news:Oe4ySkSXEHA.1652@TK2MSFTNGP09.phx.gbl...
> hi compulim,
>
> Thank you very much for your reply. It is really helpful--I found the
> problem right after I posted the original message. As you said,
Disassociate
> is not for disassociate, but for power off.
>
> I checked my PDAs. E800 is using PXA263/400MHZ, and HP5450 is using
PXA250.
>
> For my application, it is able to do network search (find networks'
> names/signal strengths/network types, etc), connect to one network with
> infrastructure/ad-hoc mode. Now I am looking for some docments/sample code
> for how to talk to other devices in the same network. Winsock? But how can
I
> find the receiver's IP address? WiFi network search can only return AP's
Mac
> address (Infrastructure mode) or network Mac address (a random value,
ad-hoc
> mode). Assuming in an ad-hoc network, there are three devices A, B, and C.
> How can A find B's or C's IP address and sending packets through Winsock?
>
> Eric
>
> "compulim" <123> wrote in message
> news:OICO641WEHA.1908@TK2MSFTNGP12.phx.gbl...
> > Hi Eric,
> >
> > Many drivers implementataion in Pocket PC is not functioning as it
should
> > be.
> >
> > So if you found one device work and another not working (with same
code),
> it
> > maybe normal.
> >
> > I'm developing WiFi applications on 4150 and Prism cards and both
behaves
> > very different.
> >
> > Check out Microsoft's document on Windows XP about NDIS and WiFi (ya,
> > Windows XP). It outlines all OID and their behaviors. For example,
> > "Disassociate" call is NOT just disconnect from network. But also turn
> WiFi
> > off. So be sure to check it out.
> >
> > btw, do you know what chipset e800 and 5 series is running? I just wrote
a
> > WiFi scanner that works on 4150 and Prism. Grab it at
> > www.kasuei.com/wifigraph
> >
> >
> > Cheers,
> >
> > Compulim
> >
> >
> > "Eric" <eric.yun@meta4hand.com> wrote in message
> > news:%23DCW0fiWEHA.2844@TK2MSFTNGP12.phx.gbl...
> > > hello,
> > >
> > > I am writing an application for PPC which needs to search other
> > > computers/APs with 802.11b connection.I have finished the "search"
part
> > > successfully: scan the network, retrieve the BSSID list, find out
SSIDs
> > and
> > > their connection type(Infrastructure/Ad hoc). Now I want to let my PPC
> > > connect one of PCs/PPCs. But it does not work. Basically I called
> > following
> > > three functions to complete the connection:
> > >
> > > 1. Disassociate(): requests PPC to disassociate the current AP;
> > > 2. SetNetworkConnectionMode(): sets connection mode to Infrastructure
or
> > Ad
> > > Hoc
> > > 3. SetAssociated(): sets connection
> > >
> > > Now I did not consider authentication and I will complete this part
> after
> > > the above code works. I tested the codeon Toshiba E800 and IPAQ5450;
> each
> > > time I tried,there was one or two errors, sometimes I cannot
> disassociate,
> > > sometimes I cannot set connection mode, and sometimes I cannot set
> > > associated AP/PC/PPC. I copied the code below,I am wondering whether
> > anybody
> > > wants to take a look at it and tell me what is the problem?
> > >
> > > BTW, I know I need disable wireless zero config, but I do not know
how.
> I
> > > think the errors I have do not come from wireless zero config.
> > >
> > > The Errors I have:
> >
>
> --------------------------------------------------------------------------
> > --
> > > --------
> > > |Error code| Error Description | Function |
> Device
> > > |
> > >
> >
>
|---------------------------------------------------------------------------
> > > --------
> > > | 31 |A device attached to the system | Disassociate() |
> Toshiba
> > > E800 |
> > > | |is not functioning | |
> > > |
> >
>
> --------------------------------------------------------------------------
> > --
> > > ---------
> > > | 50 |The network request is not | SetAssociated() |
> Toshiba
> > > E800 |
> > > | |supported | |
> > > |
> >
>
> --------------------------------------------------------------------------
> > --
> > > ---------
> > > | 1784 |The supplied user buffer is not
> |SetNetworkConnectionMode()|
> > IP
> > > AQ 5450 |
> > > | |valid for the requested operation|
> |
> > > |
> >
>
> --------------------------------------------------------------------------
> > --
> > > ---------
> > > *note: Error 50 means I cannot set OID_802_11_BSSID (I am not sure
> whether
> > > my understanding is correct), but
> > > I tried query OID_802_11_BSSID, it works fine.
> > >
> > > ####Code##########
> > >
> > > BOOL EstablishConnection(NDIS_802_11_MAC_ADDRESS
DestinationMacAddress,
> > int
> > > connectionMode){
> > > /* DestinationMacAddress: Destination PC's or PPC's MacAddress;
> > > connectionMode: Infrastructure or Ad Hoc
> > > */
> > >
> > > /*Disassociate*/
> > >
> > > BOOL retval = Disassociate();
> > > if(!retval) return FALSE;
> > >
> > >
> > > /*Set Infrastructure/Ad Hoc Mode*/
> > > int mode = connectionMode;
> > > retval = SetNetworkConnectionMode(&mode);
> > > if(!retval) return FALSE;
> > >
> > >
> > > /*Set Associated AP/PC/PPC*/
> > >
> > > retval = SetAssociated(DestinationMacAddress);
> > > if(!retval) return FALSE;
> > >
> > > return TRUE;
> > >
> > > }
> > >
> > >
> > > BOOL Disassociate()
> > > {
> > > UCHAR QueryBuffer[1024];
> > > PNDISUIO_SET_OID pSetOid;
> > > DWORD dwBytesReturned=0;
> > >
> > > pSetOid = (PNDISUIO_SET_OID) &QueryBuffer[0];
> > > pSetOid->ptcDeviceName = ptcDeviceName;
> > > pSetOid->Oid = OID_802_11_DISASSOCIATE;
> > >
> > > if (!DeviceIoControl(g_hNdisUio,
> > > IOCTL_NDISUIO_SET_OID_VALUE,
> > > (LPVOID) &QueryBuffer[0],
> > > sizeof(QueryBuffer),
> > > (LPVOID) &QueryBuffer[0],
> > > 0,
> > > &dwBytesReturned,
> > > NULL))
> > > {
> > > TCHAR szOut[64];
> > > long e = GetLastError();
> > > wsprintf(szOut, TEXT("Cannot Disassociate with Current Device\nError
> > Code:
> > > %d"),e );
> > > MessageBox(0,szOut,TEXT("Error"),MB_OK);
> > > return FALSE;
> > > }
> > >
> > > return TRUE;
> > > }
> > >
> > > BOOL SetNetworkConnectionMode(int *pnNetType)
> > > {
> > > UCHAR SetBuffer[sizeof(NDISUIO_SET_OID) +
> > > sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE)];
> > > PNDISUIO_SET_OID pSetOid;
> > > DWORD dwBytesReturned=0;
> > >
> > > if (!pnNetType)
> > > {
> > > return FALSE;
> > > }
> > >
> > > else
> > > {
> > > pSetOid = (PNDISUIO_SET_OID) &SetBuffer[0];
> > > pSetOid->ptcDeviceName = ptcDeviceName;
> > > pSetOid->Oid = OID_802_11_INFRASTRUCTURE_MODE;
> > >
> > > memcpy(&pSetOid->Data[0], pnNetType,
> > > sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE));
> > >
> > > if (!DeviceIoControl(g_hNdisUio,
> > > IOCTL_NDISUIO_SET_OID_VALUE,
> > > (LPVOID) &SetBuffer[0],
> > > sizeof(SetBuffer),
> > > (LPVOID) &SetBuffer[0],
> > > 0,
> > > &dwBytesReturned,
> > > NULL))
> > > {
> > > TCHAR szOut[64];
> > > long e = GetLastError();
> > > wsprintf(szOut, TEXT("Set Network Connection Mode\nError Code:
> > %d"),e );
> > > MessageBox(0,szOut,TEXT("Error"),MB_OK);
> > > return FALSE;
> > > }
> > > }
> > >
> > > return TRUE;
> > > }
> > >
> > >
> > > BOOL SetAssociated(NDIS_802_11_MAC_ADDRESS DestinationMacAddress)
> > > {
> > > UCHAR SetBuffer[sizeof(NDISUIO_SET_OID) +
> > sizeof(NDIS_802_11_MAC_ADDRESS)];
> > > PNDISUIO_SET_OID pSetOid;
> > > DWORD dwBytesReturned=0;
> > > int i = 0;
> > >
> > > pSetOid = (PNDISUIO_SET_OID) &SetBuffer[0];
> > > pSetOid->ptcDeviceName = ptcDeviceName;
> > > pSetOid->Oid = OID_802_11_BSSID;
> > >
> > > for ( i = 0; i < 6; i++ )
> > > {
> > > pSetOid->Data[i] = DestinationMacAddress[i];
> > > }
> > >
> > > if (!DeviceIoControl(g_hNdisUio,
> > > IOCTL_NDISUIO_SET_OID_VALUE,
> > > (LPVOID) &SetBuffer[0],
> > > sizeof(SetBuffer),
> > > (LPVOID) &SetBuffer[0],
> > > 0,
> > > &dwBytesReturned,
> > > NULL))
> > > { TCHAR szOut[64];
> > >
> > > long e = GetLastError();
> > > wsprintf(szOut, TEXT("Set Associated AP/PC ERROR\nError Code:
> %d"),e );
> > > MessageBox(0,szOut,TEXT("Error"),MB_OK);
> > > return FALSE;
> > > }
> > >
> > > return TRUE;
> > > }
> > >
> > >
> > > ####End of Code##########
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: Integrated WiFi and BlueTooth have stopped functioning
    ... My laptop integrated WiFi has stopped working again. ... the network window. ... The BlueTooth radios are not on the device ...
    (microsoft.public.windowsxp.general)
  • Re: link 2 linux boxes through rj45 c.o. cable
    ... ethernet interface linked with the ethernet card working in DHCP mode. ... other stuff that actually is not useful now, so forget about wifi. ... I would like link these boxes through by means of a cross over cable ... You are trying to create a two workstation network. ...
    (comp.os.linux.misc)
  • Re: wireless connection stopped working
    ... I had to press the `wifi' button on my laptop. ... Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 ... NetXtreme BCM5751M Gigabit Ethernet PCI Express ... product: PRO/Wireless 2200BG Network Connection ...
    (Ubuntu)
  • Integrated WiFi and BlueTooth have stopped functioning
    ... My laptop integrated WiFi has stopped working again. ... a WiFicard but without the card I cannot see any network in the network ... http://www.ezlan.net/wireless.html but the window when I click Properties ... The BlueTooth radios are not on the device ...
    (microsoft.public.windowsxp.general)
  • Re: why so slow?
    ... Please start with my article on diagnosing network problems. ... Now if you have a WiFi network, are the computers connected by Ethernet, or ... and possible performance problems on the computers themselves. ... Differences between Ethernet and WiFi: ...
    (microsoft.public.windowsxp.network_web)