Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Binding specific network interface to socket: (1 Item)
   
Binding specific network interface to socket  
hi all

i am trying to develop a ping program for zynq based board which has two interfaces eth0 & eth1. my program will be 
accepting 3 params, interface name, ip address to be pinged from the board and the time period for ping.

For ping I am using SOCK_RAW (Raw socket) and I have to bind the “port = eth0 / eth1” to the socket to allow packets 
to be sent or received on this specified interface only
For this I am doing in the following way:
...
struct ifreq ifr;

snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "ETH0");
setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, (void *)&ifr, sizeof(ifr));

but I am getting “protocol unavailable for this option”. 
how can i bind a particular network interface to a created socket in qnx