c++网络编程
qq_39945321
这个作者很懒,什么都没留下…
展开
-
HTTP协议
示例:请求:GET / HTTP/1.1Host: 106.53.115.186User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: en-US,en;q=0.5Accept-Encoding: gzip, ..原创 2020-05-30 20:08:06 · 174 阅读 · 0 评论 -
网络编程错误处理
1.出错处理的意义 网络编程中不能保证每次的函数调用都成功,应该进行错误处理2.头文件 #include <errno.h> #include <string.h> 调用网络编程的api时,如果出现了错误,错误代码会写入全局变量errno。使用errno需要包含头文件 errno.h 3.错误处理函数 char* strerror(int errno); errno:错误代码errno 返回值:将...原创 2020-05-30 16:44:18 · 187 阅读 · 0 评论 -
linux网络编程API
1.socket函数 用于创建一个socket,返回其句柄 #include <sys/types.h> #include <sys/socket.h> int socket(int domin, int type, int protoclo) domin: AF_INET:使用TCP或者UDP来传输,用IPV4的地址 AF_INET6:使用IPV6的地址 AF_UNIX:本地协议,使用在lin...原创 2020-05-30 12:59:14 · 156 阅读 · 0 评论