在ACE中如何获得本地的ip地址

来源:互联网 发布:运城广电网络二维码 编辑:程序博客网 时间:2024/06/16 17:50
#include "ace/INET_Addr.h" void print_all_interfaces(){ACE_INET_Addr *the_addr_array;size_t count = 0;int rc = ACE::get_ip_interfaces (count , the_addr_array);char address[30];int i = 0;while (i < count){  (the_addr_array+i)->addr_to_string(address, sizeof(address));  printf("%s\n", address);  i++;}delete [] the_addr_array;system("pause");}

0 0
原创粉丝点击