Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 21:05, 26 October 2007.

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

From Forum Nokia Wiki

Original: Start new Socket Sub-connection to Access Point

SIOCIFSTART e SIOCIFACTIVESTART são de fato chamadas a ioctl() que iniciam conexões e sub-conexões. Todas as comunicações via socket começam com chamadas como: connect(), read(), write(), send(), receive(), sendto(), e recvfrom() que devem vir antes de chamar SIOCIFSTART e SIOCIFACTIVESTART. Chamadas como getsockopt() e getsockname() que não requerem nenhuma conexão não dependem de SIOCIFSTART ou de SIOCIFACTIVESTART.

O código para iniciar uma nova conexão via sockets pode ser visto no artigo Iniciar uma nova conexão via sockets a um ponto de acesso.

O seguinte código mostra como iniciar uma nova sub-conexão usando uma conexão já aberta.

void NewSubconnection(char *ifname)
{
	ifreq ifr;
	int sockfd1, sockfd2;
		
	// Nome da interface
	strcpy(ifr.ifr_name, ifname);
	
	sockfd1 = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
	ioctl(sockfd1,SIOCSIFNAME, &ifr);
	ioctl(sockfd1, SIOCIFSTART , &ifr);
		
	sockfd2 = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
	ioctl(sockfd2,SIOCSIFNAME, &ifr);
  	// Abre sub-conexão usando a conexão aberta anteriormente
        // usando SIOCSIFNAME
	ioctl(sockfd2, SIOCIFACTIVESTART , &ifr);
 
 
	// recvfrom() e sendto() nos sockets sockfd2 e sockfd1
 
	ioctl(sockfd2, SIOCIFSTOP, &ifr); // Para a conexão
	ioctl(sockfd1, SIOCIFSTOP, &ifr); // Para a conexão
	close(sockfd2);
	close(sockfd1);
}


Links relacionados

Related Discussions
Thread Thread Starter Forum Replies Last Post
Nokia 7650 and Socket communication problem wauer Mobile Java Networking & Messaging & Security 9 2003-04-29 12:56
Multiple access point selections dkogias Open C 0 2007-12-19 02:00
Data from a 3650 to a PC? speedsix Mobile Java General 1 2004-03-24 14:48
Nokia 6820 MIDP1.0 + Sockets? nuce Mobile Java Networking & Messaging & Security 3 2004-04-01 06:53
two quetions-appuifw.Icon and socket llapplecn Python 2 2005-07-08 09:42
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX