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> #
阅读全文
摘要:#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>
阅读全文
摘要:#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>
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> #
阅读全文
摘要:#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
阅读全文
摘要:#include <netdb.h> /*返回:若成功则为非空指针,若出错则为NULL且设置h_errno*/ struct hostent *gethostbyname(const char *hostname); struct hostent { char *h_name; /*official
阅读全文
摘要:void dg_cli(FILE *fp, int sockfd, const struct sockaddr * pservaddr, socklen_t servlen) { int n; char sendline[maxline], recvline[maxline+1]; char err
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文
摘要:#include <sys/socket.h> /*返回:若成功则为非负描述符,若出错则为-1*/ int accept(int sockfd, const struct sockaddr *cliaddr, socklen_t *addrlen); accept函数由TCP服务器调用,用于从已完成
阅读全文
摘要:#include <sys/socket.h> /*返回:若成功则为0,若出错则为-1*/ int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen); sockfd是由socket函数返回的socket描述符; 第二
阅读全文
摘要:#include <sys/socket.h> /*返回:若成功则为非负描述符,若出错则为-1*/ int socket(int family, int type, int protocol); family参数指明协议族,也常被称为协议域; AF_INET IPv4协议 AF_INET6 IPv6
阅读全文
摘要:IPv4 socket地址结构通常也称为“网际socket地址结构”,它以sockaddr_in命名,定义在<netinet/in.h> struct in_addr { in_addr_t s_addr; /*32-bit IPv4 address*/ }; struct sockaddr_in
阅读全文
摘要:#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
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <time.h> #include <errno.h> #include <string.h> const
阅读全文