I have the following code which by default connects to interface \"eth0\" which is a 1G NIC, but I would like to connect using \"eth5\", which is a 10G NIC.
According to the information here you can use setsockopt() to achieve this as follows:
setsockopt()
char* interface = "eth5"; setsockopt( socket_file_descriptor_, SOL_SOCKET, SO_BINDTODEVICE, interface, 4 );
The final parameter, 4, represents the number of bytes in the interface variable.