09 2022 档案

摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> # 阅读全文
posted @ 2022-09-30 12:55 东宫得臣 阅读(24) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/wait.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> 阅读全文
posted @ 2022-09-29 13:26 东宫得臣 阅读(26) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/wait.h> #include <netinet/in.h> #include <arpa/inet.h> #include <time.h> 阅读全文
posted @ 2022-09-29 11:29 东宫得臣 阅读(7) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> # 阅读全文
posted @ 2022-09-22 14:06 东宫得臣 阅读(103) 评论(0) 推荐(0) 编辑
摘要:#include <netdb.h> #include <arpa/inet.h> #include <stdio.h> #include <stdlib.h> const int inet_addrstrlen=16; int main(int argc, char **argv) { char 阅读全文
posted @ 2022-09-15 23:49 东宫得臣 阅读(28) 评论(0) 推荐(0) 编辑
摘要:#include <netdb.h> /*返回:若成功则为非空指针,若出错则为NULL且设置h_errno*/ struct hostent *gethostbyname(const char *hostname); struct hostent { char *h_name; /*official 阅读全文
posted @ 2022-09-15 22:59 东宫得臣 阅读(84) 评论(0) 推荐(0) 编辑
摘要:void dg_cli(FILE *fp, int sockfd, const struct sockaddr * pservaddr, socklen_t servlen) { int n; char sendline[maxline], recvline[maxline+1]; char err 阅读全文
posted @ 2022-09-15 11:47 东宫得臣 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> c 阅读全文
posted @ 2022-09-15 10:47 东宫得臣 阅读(15) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> c 阅读全文
posted @ 2022-09-15 10:36 东宫得臣 阅读(9) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <time.h> #include <errno.h> #in 阅读全文
posted @ 2022-09-08 14:46 东宫得臣 阅读(15) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> c 阅读全文
posted @ 2022-09-08 12:56 东宫得臣 阅读(58) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <time.h> #include <errno.h> #in 阅读全文
posted @ 2022-09-08 10:51 东宫得臣 阅读(35) 评论(0) 推荐(0) 编辑
摘要:#include <sys/socket.h> /*返回:若成功则为非负描述符,若出错则为-1*/ int accept(int sockfd, const struct sockaddr *cliaddr, socklen_t *addrlen); accept函数由TCP服务器调用,用于从已完成 阅读全文
posted @ 2022-09-07 11:10 东宫得臣 阅读(286) 评论(0) 推荐(0) 编辑
摘要:#include <sys/socket.h> /*返回:若成功则为0,若出错则为-1*/ int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen); sockfd是由socket函数返回的socket描述符; 第二 阅读全文
posted @ 2022-09-07 10:05 东宫得臣 阅读(57) 评论(0) 推荐(0) 编辑
摘要:#include <sys/socket.h> /*返回:若成功则为非负描述符,若出错则为-1*/ int socket(int family, int type, int protocol); family参数指明协议族,也常被称为协议域; AF_INET IPv4协议 AF_INET6 IPv6 阅读全文
posted @ 2022-09-06 18:13 东宫得臣 阅读(33) 评论(0) 推荐(0) 编辑
摘要:IPv4 socket地址结构通常也称为“网际socket地址结构”,它以sockaddr_in命名,定义在<netinet/in.h> struct in_addr { in_addr_t s_addr; /*32-bit IPv4 address*/ }; struct sockaddr_in 阅读全文
posted @ 2022-09-06 17:32 东宫得臣 阅读(136) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> c 阅读全文
posted @ 2022-09-06 15:05 东宫得臣 阅读(16) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <time.h> #include <errno.h> #include <string.h> const 阅读全文
posted @ 2022-09-06 15:02 东宫得臣 阅读(42) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示