命令行选项解析函数getopt()
摘要:1、定义: int getopt(int argc, char * const argv[], const char *optstring); 2、描述: getopt是用来解析命令行选项参数的,但是只能解析短选项: -d 100,不能解析长选项:--prefix 3、参数: argc:main()
阅读全文
ubuntu修改ls显示的目录颜色
摘要:https://blog.csdn.net/qq_39101111/article/details/78904217
阅读全文
sockfd_to_family函数
摘要:#include #include #define SA struct sockaddr int sockfd_to_family(int sockfd) { struct sockaddr_storage ss; socklen_t len; len = sizeof(ss); if (getsockname(sockf...
阅读全文
family_to_level函数
摘要:#include #include int family_to_level(int family) { switch (family) { case AF_INET: { return (IPPROTO_IP); } #ifdef IPV6 case AF_INET6: { ...
阅读全文
mcast_get_ttl函数
摘要:#include #include #include #include int sockfd_to_family(int); int mcast_get_ttl(int sockfd) { switch (sockfd_to_family(sockfd)) { case AF_INET: { u_char ...
阅读全文
mcast_get_loop函数
摘要:#include #include #include #include int sockfd_to_family(int); int mcast_get_loop(int sockfd) { switch (sockfd_to_family(sockfd)) { case AF_INET: { u_char ...
阅读全文
mcast_set_ttl函数
摘要:#include #include #include #include int sockfd_to_family(int); int mcast_set_ttl(int sockfd, int val) { switch (sockfd_to_family(sockfd)) { case AF_INET: { u...
阅读全文
mcast_set_loop函数
摘要:#include #include #include #include int sockfd_to_family(int); int mcast_set_loop(int sockfd, int onoff) { switch (sockfd_to_family(sockfd)) { case AF_INET: { ...
阅读全文
mcast_set_if函数
摘要:#include #include #include #include #include #include int sockfd_to_family(int); int mcast_set_if(int sockfd, const char *ifname, u_int ifindex) { switch (sockfd_to_fami...
阅读全文
mcast_get_if函数
摘要:#include int sockfd_to_family(int); int mcast_get_if(int sockfd) { switch (sockfd_to_family(sockfd)) { case AF_INET: { /* TODO: similar to mcast_set_if() */ retu...
阅读全文
mcast_block_source函数
摘要:#include #include #define SA struct sockaddr int mcast_block_source(int sockfd, const SA *src, socklen_t srclen,const SA *grp, socklen_t grplen) { #ifdef MCAST_BLOCK_SOURCE ...
阅读全文
mcast_unblock_source函数
摘要:#include #include #define SA struct sockaddr int mcast_unblock_source(int sockfd, const SA *src, socklen_t srclen,const SA *grp, socklen_t grplen) { #ifdef MCAST_UNBLOCK_SOURCE ...
阅读全文
mcast_join_source_group函数
摘要:#include #include #include #define SA struct sockaddr int mcast_join_source_group(int sockfd, const SA *src, socklen_t srclen,const SA *grp, socklen_t grplen, const char...
阅读全文
mcast_join函数
摘要:#include #include #include #include #define SA struct sockaddr int family_to_level(int); int mcast_join(int sockfd, const SA *grp, socklen_t grplen, const char *ifnam...
阅读全文
密钥管理套接字
摘要:一、概述 (1)RFC2367介绍了一个通用密钥管理API,可用于IPsec和其他网络安全服务;该API创建了一个新的协议族即PF_KEY域; 在这个密钥管理域中,唯一支持的一种套接字是原始套接字; (2)密钥管理套接字上支持3种类型的操作: 二、读和写 (1)穿越密钥管理套接字的所有消息都有同样的
阅读全文
路由套接字
摘要:一、路由套接字中支持的操作 在路由套接字中支持的唯一一种套接字是原始套接字,路由套接字上支持3中类型的操作: (1)进程可以通过写出到路由套接字而往内核发送消息;路径的增加和删除采用这种操作实现; (进程 》 内核) (2)进程可以通过从路由套接字读入而自内核接收消息;内核采用这种操作通知进程已收到
阅读全文
ioctl函数
摘要:一、函数原型 二、和网络相关的请求(request) (1)套接字操作 (2)文件操作 (3)接口操作 (4)ARP告诉缓存操作 (5)路由表操作 (6)流系统 三、request参数及arg地址必须指向的数据类型 四、案列:获取所有网络设备接口名称 五、关于ioctl函数应该注意 六、get_if
阅读全文
非阻塞connect:Web客户程序
摘要:一、web.h 二、web.c 三、home_page.c 四、start_connect.c 五、tcp_connect.c 六、host_serv.c 七、write_get_cmd.c 八、writen.c 九、others.c 十、error.c 十一、Makefile
阅读全文
非阻塞connect
摘要:int connect_nonb(int sockfd, const SA *saptr, socklen_t salen, int nsec) { int flags, n, error; socklen_t len; fd_set rset, wset; struct timeval tval; ...
阅读全文
使用fork的str_cli函数
摘要:void str_cli(FILE *fp, int sockfd) { pid_t pid; char sendline[MAXLINE], recvline[MAXLINE]; if ( (pid = fork()) == 0) { /* child: server -> stdout */ while (read(sock...
阅读全文
|