- 套接字
- IP地址 + port(端口号) = socket(套接字)
- socket常见API
int socket(int domain, int type, int protocol);
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
int listen(int sockfd, int backlog);
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
- socket、TCP、Http连接区分
- Socket:通信的基础,提供发送和接收数据的能力,就像整个邮局系统。
- TCP:一种可靠的通信方式,确保数据正确、完整地送达,类似于挂号信服务。
- HTTP:一个在TCP之上的协议,专门用于传输网页等文档,像是特定的电子邮件系统,专门处理特定格式的消息。
- 参考
- https://blog.csdn.net/sjsjnsjnn/article/details/127011817?ops_request_misc=%257B%2522request%255Fid%2522%253A%25221148896F-F03A-47BE-82A1-130EEC1E1A10%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=1148896F-F03A-47BE-82A1-130EEC1E1A10&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduend~default-2-127011817-null-null.142v100pc_search_result_base6&utm_term=套接字编程&spm=1018.2226.3001.4187
- https://blog.csdn.net/qq_44154915/article/details/136699917?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7Ebaidujs_baidulandingword%7ECtr-1-136699917-blog-129502560.235%5Ev43%5Epc_blog_bottom_relevance_base5&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7Ebaidujs_baidulandingword%7ECtr-1-136699917-blog-129502560.235%5Ev43%5Epc_blog_bottom_relevance_base5&utm_relevant_index=2