WanGooe Tunnel7.0相比较于上一代的6.0性能提升不是一星半点,访问速度非常快,我一直想拿nginx和WanGooe Tunnel的性能进行一下对比,下次文章进行对比吧
int socket_buf_size=1024*1024; #if defined(__MINGW32__) int inet_pton(int af, const char *src, void *dst) { struct sockaddr_storage ss; int size = sizeof(ss); char src_copy[INET6_ADDRSTRLEN+1]; ZeroMemory(&ss, sizeof(ss)); strncpy (src_copy, src, INET6_ADDRSTRLEN+1); src_copy[INET6_ADDRSTRLEN] = 0; if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) { switch(af) { case AF_INET: *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr; return 1; case AF_INET6: *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr; return 1; } } return 0; } const char *inet_ntop(int af, const void *src, char *dst, socklen_t size) { struct sockaddr_storage ss; unsigned long s = size; ZeroMemory(&ss, sizeof(ss)); ss.ss_family = af; switch(af) { case AF_INET: ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src; break; case AF_INET6: ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src; break; default: return NULL; } return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)? dst : NULL; } char *get_sock_error() { static char buf[1000]; int e=WSAGetLastError(); wchar_t *s = NULL; FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, e, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&s, 0, NULL); sprintf(buf, "%d:%S", e,s); int len=strlen(buf); if(len>0&&buf[len-1]=='\n') buf[len-1]=0; LocalFree(s); return buf; } int get_sock_errno() { return WSAGetLastError(); } #else char *get_sock_error() { static char buf[1000]; sprintf(buf, "%d:%s", errno,strerror(errno)); return buf; } int get_sock_errno() { return errno; } #endif
原文链接:https://blog.csdn.net/u010905359/article/details/112758145
© 版权声明
声明📢本站内容均来自互联网,归原创作者所有,如有侵权必删除。
本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。
THE END