First explain the debugging skills: The program needs to implement the wireless network card, because the PC may be multi-network card (wired network card, wireless network card, virtual network card), so when the packet is not necessarily from the wireless network card, Lib library should also not handle the choice of multi-network card. So in the debugging need to put in addition to the wireless network card (wired network card, virtual network card) are disabled, the program in execution, there will be a lot of data through the network port, so you can also see through the Wireshark network card port whether there is data access, as long as the following interface can be opened. Implementation code:
#include <stdio.h>
#include<string.h>
#include"elian.h"
#pragma comment(lib,"elian.lib")
int main(int argc,char*argv[])
{
unsignedchar target[]={0xff,0xff,0xff,0xff,0xff,0xff};
int ret =0;
unsignedint flag = ELIAN_SEND_V4;
void*handle = NULL;
unsignedchar authmode =0x04;
printf("Create elian Handle\n");
handle = elianNew(NULL,0, target, ELIAN_SEND_V4);
printf("Set TYPE_ID_AM\n");
ret = elianPut(handle, TYPE_ID_AM,(char*)&authmode,1);
printf("Set TYPE_ID_SSID ret=%d\n", ret);
ret = elianPut(handle, TYPE_ID_SSID,"Rookie", strlen("Rookie"));
printf("Set TYPE_ID_PWD ret=%d\n", ret);
ret = elianPut(handle, TYPE_ID_PWD,"123123123", strlen("123123123"));
printf("Set TYPE_ID_CUST ret=%d\n", ret);
ret = elianPut(handle, TYPE_ID_CUST,"aaaaaaa", strlen("aaaaaaa"));
printf("elianStart ret=%d\n", ret);
elianStart(handle);
getchar();
elianStop(handle);
elianDestroy(handle);
}
Specify the Elian.lib library path:
From for notes (Wiz)
Implementation of MTK Elian (SmartLink) under WIN32