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 18:26, 2 October 2007.

Start new Socket Sub-connection to Access Point

From Forum Nokia Wiki

SIOCIFSTART and SIOCIFACTIVESTART are actual ioctl( ) calls which would start a connection or subconnection. All the socket communication calls such as connect(), read(), write(), send(), receive(), sendto(), and recvfrom() should come after calling SIOCIFSTART and SIOCIFACTIVESTART. Calls such as getsockopt(), and getsockname() that do not require any connection do not have any dependency on SIOCIFSTART and SIOCIFACTIVESTART.

The code to start a new socket connection can be seen here.

The following code shows how to start a new subconnection using an existing connection.

void NewSubconnection(char *ifname)
{
	ifreq ifr;
	int sockfd1, sockfd2;
		
	// Name of the 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);
  	//Start subconnection using a connection created earlier 
        //using SIOCSIFNAME
	ioctl(sockfd2, SIOCIFACTIVESTART , &ifr);
 
 
	//recvfrom() and sendto() operations on socket sockfd2 and sockfd1
 
	ioctl(sockfd2, SIOCIFSTOP, &ifr); // Stop the connection
	ioctl(sockfd1, SIOCIFSTOP, &ifr); // Stop the connection
	close(sockfd2);
	close(sockfd1);
}


Links

 
Powered by MediaWiki