#include typedef struct _gEthIfaceInfo
{
unsigned int etherIP;
char etherName[IF_NAMESIZE];
}EtherIfaceInfo_t;
EtherIfaceInfo_t gEtherIfaceInfo;
//
//@usage: get avail iface
//
static bool getAvailIface(EtherIfaceInfo_t &ifaceInfo)
{
int i, flags;
struct ifconf data;
struct ifreq device[IF_NAMESIZE];//16
data.ifc_len = sizeof(device);
data.ifc_req = device;
memset(data.ifc_buf, 0, data.ifc_len);
flags = IFF_UP | IFF_RUNNING | IFF_MULTICAST;
int sockfd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if(sockfd < 0)
{
perror("socket fails");
return false;
}
/* get list of network interfaces */
if (ioctl(sockfd, SIOCGIFCONF, &data) < 0)
{
ERROR_LOG