Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Iniciar uma nova conexão via sockets a um ponto de acesso

From Wiki
Jump to: navigation, search
Article Metadata

Artigo
Tradução:
Por kyllercg
Última alteração feita por hamishwillee em 09 Dec 2011


Um vez que a lista de pontos de acesso disponíveis for obtida, o seguinte código mostra como iniciar uma nova conexão usando os pontos de acesso disponíveis.

void ConnectToAP(char *ifname)
{
ifreq ifr;
int sockfd;
 
// Nome da interface
strcpy(ifr.ifr_name, ifname);
 
sockfd = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
ioctl(sockfd,SIOCSIFNAME, &ifr);
ioctl(sockfd, SIOCIFSTART , &ifr);
 
 
// Operações recvfrom() e sendto() no socket sockfd
 
ioctl(sockfd, SIOCIFSTOP, &ifr);
 
close(sockfd);
return ret;
}

No código acima, SIOCSIFNAME API é usada para selecionar o ponto de acesso.


Links relacionados

This page was last modified on 9 December 2011, at 04:26.
230 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×