From b11539062bed40f2555b4b954843740d03a5b003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=98=82?= <15606216810@163.com> Date: Mon, 8 Aug 2022 09:16:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84windows=E7=8E=AF=E5=A2=83sock?= =?UTF-8?q?et=E8=AF=BB=E5=86=99=E7=BC=93=E5=86=B2=E5=8C=BA=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hal/socket/win32/socket_win32.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hal/socket/win32/socket_win32.c b/hal/socket/win32/socket_win32.c index e8e81e60..65c99e74 100644 --- a/hal/socket/win32/socket_win32.c +++ b/hal/socket/win32/socket_win32.c @@ -273,7 +273,9 @@ TcpServerSocket_create(const char* address, int port) serverSocket->backLog = 10; setSocketNonBlocking((Socket)serverSocket); - //setSocketBufferSize((Socket)serverSocket, 512*1024, 512*1024); + + if(CONFIG_SET_SOCKET_BUFSIZE == 1) + setSocketBufferSize((Socket)serverSocket, CONFIG_SOCKET_RCVBUFSIZE*1024, CONFIG_SOCKET_SNDBUFSIZE*1024); socketCount++; } @@ -305,7 +307,9 @@ ServerSocket_accept(ServerSocket self) socketCount++; setSocketNonBlocking(conSocket); - //setSocketBufferSize(conSocket, 512*1024, 512*1024); + + if(CONFIG_SET_SOCKET_BUFSIZE == 1) + setSocketBufferSize(conSocket, CONFIG_SOCKET_RCVBUFSIZE*1024, CONFIG_SOCKET_SNDBUFSIZE*1024); if (DEBUG_SOCKET) printf("WIN32_SOCKET: connection accepted\n"); @@ -423,7 +427,9 @@ Socket_connectAsync(Socket self, const char* address, int port) return false; setSocketNonBlocking(self); - //setSocketBufferSize(self, 512*1024, 512*1024); + + if(CONFIG_SET_SOCKET_BUFSIZE == 1) + setSocketBufferSize(self, CONFIG_SOCKET_RCVBUFSIZE*1024, CONFIG_SOCKET_SNDBUFSIZE*1024); if (connect(self->fd, (struct sockaddr *) &serverAddress, sizeof(serverAddress)) == SOCKET_ERROR) { if (WSAGetLastError() != WSAEWOULDBLOCK) {