摘要: 除了题目中的问题,其实在执行命令:service network restart时,会报错: 解决办法: 首先需要修改70-persistent-net.rules文件: vim /etc/udev/rules.d/70-persistent-net.rules 然后修改ifcfg-eth0文件: 阅读全文
posted @ 2017-03-28 16:04 yaox 阅读(21191) 评论(0) 推荐(0) 编辑
摘要: 2. 指令的解决方法: oute add -net 255.255.255.255 netmask 255.255.255.255 dev eth0 metric 1 或者 route add -host 255.255.255.255 dev eth0 需要用到函数:setsockopt(); s 阅读全文
posted @ 2017-03-26 18:02 yaox 阅读(1229) 评论(0) 推荐(0) 编辑
摘要: 这和inet_ntoa的返回值有关系: 函数声明:char *inet_ntoa (struct in_addr); 返回点分十进制的字符串在静态内存中的指针。 所在头文件:<arpa/inet.h> 函数功能:将网络地址转换成 “.” 点隔的字符串格式 返回值: 如果正确,返回一个字符指针,指向一 阅读全文
posted @ 2017-03-24 13:13 yaox 阅读(203) 评论(0) 推荐(0) 编辑
摘要: /*代码来自StackOverflow: http://stackoverflow.com/questions/212528/linux-c-get-the-ip-address-of-local-computer */ #include <stdio.h> #include <sys/types. 阅读全文
posted @ 2017-03-23 12:54 yaox 阅读(909) 评论(0) 推荐(0) 编辑