摘要: int getpeername(int s, struct sockaddr *name, socklen_t *namelen);描述获取socket的对方地址struct sockaddr_in sa;int len = sizeof(sa);if(!getpeername(sockfd, (s 阅读全文
posted @ 2019-10-29 21:10 YZFHKMS-X 阅读(5608) 评论(0) 推荐(0)
摘要: 在C/C++写网络程序的时候,往往会遇到字节的网络顺序和主机顺序的问题。 这时就可能用到htons(), ntohl(), ntohs(),htons()这4个网络字节顺序与本地字节顺序之间的转换函数: htonl()--"Host to Network Long int" 32Bytes ntoh 阅读全文
posted @ 2019-10-29 21:09 YZFHKMS-X 阅读(787) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<stdlib.h> #include<string.h> #include<errno.h> #include<sys/types.h> #include<sys/socket.h> #include<netinet/in.h> #define 阅读全文
posted @ 2019-10-29 20:04 YZFHKMS-X 阅读(3829) 评论(0) 推荐(0)
摘要: Visual Studio 2019 EnterpriseBF8Y8-GN2QH-T84XB-QVY3B-RC4DF Visual Studio 2019 EnterpriseBF8Y8-GN2QH-T84XB-QVY3B-RC4DFVisual Studio 2019 ProfessionalNY 阅读全文
posted @ 2019-10-29 19:24 YZFHKMS-X 阅读(3185) 评论(0) 推荐(1)