【相关文章:personal FAQs】 【扩展阅读:port linux 2.6.11.7 】 these were writed and collected by kf701, 【扩展信息:在SLES 9下查看线程的cpu利用率】 you can use and modify them but no warranty. contact with me : kf_701@21cn.com 程序1:检测接口的 inet_addr,netmask,broad_addr 程序2:检查接口的物理连接是否正常 程序3:更简单一点测试物理连接 程序4:调节音量 ***************************程序1**************************************** #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/ioctl.h> #include <net/if.h> static void usage(){ printf("usage : ipconfig interface \n"); exit(0); } int main(int argc,char **argv) { struct sockaddr_in *addr; struct ifreq ifr; char *name,*address; int sockfd; if(argc != 2) usage(); else name = argv[1]; sockfd = socket(af_inet,sock_dgram,0); strncpy(ifr.ifr_name,name,ifnamsiz-1); if(ioctl(sockfd,siocgifaddr,&ifr) == -1) perror("ioctl error"),exit(1); ... 下一页