随笔分类 - 网络编程
摘要:Server: 1 from flask import Flask, request, jsonify 2 import json 3 import re 4 import os 5 import subprocess 6 7 conf_file_src = '/etc/nginx/nginx.co
阅读全文
摘要:状态机: bbr算法主要流程: 代码: 1 /* Bottleneck Bandwidth and RTT (BBR) congestion control 2 * 3 * BBR congestion control computes the sending rate based on the d
阅读全文
摘要:在调试时服务器程序会不断重启,由于TCP的四次挥手机制,结束程序后2MSL的时间内无法再次绑定该端口。可以对监听fd设置SO_REUSEADDR和SO_REUSEPORT标志,立即回收端口号。 int optval = 1; setsockopt(fdServer, SOL_SOCKET, SO_R
阅读全文
摘要:把自己的项目部署到阿里云ecs服务器之后,只有127.0.0.1才能连接到服务器端,检查了阿里云安全组规则,以及socket绑定的地址无误后,发现没有开启服务器防火墙的对应端口。 firewall-cmd --add-port=[端口号]/tcp --permanent firewall-cmd -
阅读全文
摘要:SockClient.h #pragma once #include<functional> #define _WINDOWS #ifdef _WINDOWS #define _WINSOCK_DEPRECATED_NO_WARNINGS #ifndef _WINSOCK2_H #include<W
阅读全文
摘要:#pragma once #ifndef WINSOCK2_H #define _WINSOCK_DEPRECATED_NO_WARNINGS #include<WinSock2.h> #include<Windows.h> #pragma comment(lib, "ws2_32.lib") #e
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 int main(int argc,char *argv[]) 10 { 11 int s; 12 struct sockaddr_in server_addr; 13 ...
阅读全文