临时参考网站

https://blog.csdn.net/daiyudong2020/article/details/50449489

https://blog.csdn.net/boiled_water123/article/details/104161471

https://www.zhihu.com/question/23614342

 https://blog.csdn.net/jasonwang1002/article/details/99434924

https://www.cnblogs.com/ywcz060/p/5629573.html

https://bbs.csdn.net/topics/370135941

https://blog.csdn.net/midion9/article/details/49883063

https://www.zhihu.com/question/58292134/answer/156391489

 

c++ API 参考网站:

https://cplusplus.com/

https://tool.oschina.net/apidocs/apidoc?api=cpp%2Fen%2Fcpp.html

 

 

 

#ifdef WIN32
SOCKET sockfd;
#else
int sockfd;
#endif
int i_tmp, nZero, nRet;
struct timeval time_val;
struct linger ling;
unsigned long nonblocking = 1;
//struct timeval time_val;

 

s_us2time_val(&time_val,180*1000000);

i_tmp = 1;
ling.l_onoff = 1;
ling.l_linger = 0;
nonblocking = 1;


ioctlsocket(sockfd, FIONBIO, (void *)&nonblocking);
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&i_tmp, sizeof(i_tmp));


//setsockopt(sockfd, SOL_SOCKET, SO_LINGER, (char *)&ling, sizeof(ling));
setsockopt(sockfd, SOL_SOCKET, SO_LINGER, (char *)&ling, sizeof(ling));

i_tmp = 0;
setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,(char *)&i_tmp,sizeof(i_tmp) );
setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (char *)&time_val, sizeof(time_val));
setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, (char *)&time_val, sizeof(time_val));
nZero = 0;
nRet = setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char *)&nZero, sizeof(nZero));
if (SOCKET_ERROR == nRet)
{
////printf("setsockopt(SNDBUF): %d\n", WSAGetLastError());
//return(FALSE);
}

// Disable receive buffering on the socket. Setting SO_RCVBUF
// to 0 causes winsock to stop bufferring receive and perform
// receives directly from our buffers, thereby reducing CPU usage.
nZero = 0;
nRet = setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, (char *)&nZero, sizeof(nZero));
if (SOCKET_ERROR == nRet)
{
////printf("setsockopt(SO_RCVBUF): %d\n", WSAGetLastError());
//return(FALSE);
}
return 0;

【tcp 延时高 参考网站】

https://blog.csdn.net/guangyinglanshan/article/details/79027849

 

 

 

 

 

pycurl 问题

https://github.com/pycurl/pycurl/blob/master/doc/thread-safety.rst

https://www.cnblogs.com/my8100/p/7388865.html

https://www.baidu.com/s?ie=UTF-8&wd=Global%20Interpreter%20Lock

 

https://blog.csdn.net/shanliangliuxing/article/details/8617256

 

Accessing the same PycURL object from different threads is OK when this object is not involved in active transfers, as Python internally has a Global Interpreter Lock and only one operating system thread can be executing Python code at a time.

 

posted @ 2021-07-28 23:30  雪域蓝心  阅读(44)  评论(0编辑  收藏  举报