diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user new file mode 100644 index 00000000..84fe894f --- /dev/null +++ b/CMakeLists.txt.user @@ -0,0 +1,271 @@ + + + + + + EnvironmentId + {7cd13185-8f0a-4828-a39b-a90c87177fdb} + + + ProjectExplorer.Project.ActiveTarget + 1 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + false + true + false + 0 + true + true + 0 + 8 + true + false + 2 + true + true + true + *.md, *.MD, Makefile + false + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + + 0 + true + + true + true + Builtin.DefaultTidyAndClazy + 2 + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + MinGW 32bit + MinGW 32bit + {322e3fa8-c77b-446b-a0db-2847debf3b82} + 0 + 0 + 0 + + MinSizeRel + -DCMAKE_GENERATOR:STRING=MinGW Makefiles +-DCMAKE_BUILD_TYPE:STRING=MinSizeRel +-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake +-DCMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} +-DCMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} +-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} +-DQT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} + D:\Coding\C\iec61850\libiec61850_angwangiot\build-libiec61850-MinGW_32bit-MinSizeRel + + + + all + + true + Build + CMakeProjectManager.MakeStep + + 1 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + + clean + + true + Build + CMakeProjectManager.MakeStep + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Minimum Size Release + CMakeProjectManager.CMakeBuildConfiguration + + 1 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + ProjectExplorer.CustomExecutableRunConfiguration + + false + true + false + true + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop + MinGW 64bit + MinGW 64bit + {fcdd76d2-4a09-4fb7-ae7a-85dbdec0159b} + 0 + 0 + 0 + + MinSizeRel + -DCMAKE_GENERATOR:STRING=MinGW Makefiles +-DCMAKE_BUILD_TYPE:STRING=MinSizeRel +-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake +-DQT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} +-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} +-DCMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} +-DCMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} + D:\Coding\C\iec61850\libiec61850_angwangiot\build-libiec61850-MinGW_64bit-MinSizeRel + + + + all + + true + Build + CMakeProjectManager.MakeStep + + 1 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + + clean + + true + Build + CMakeProjectManager.MakeStep + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Minimum Size Release + CMakeProjectManager.CMakeBuildConfiguration + + 1 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + ProjectExplorer.CustomExecutableRunConfiguration + + false + true + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/config/stack_config.h b/config/stack_config.h index 294eed17..bf89d264 100644 --- a/config/stack_config.h +++ b/config/stack_config.h @@ -53,6 +53,15 @@ /* number of concurrent MMS client connections the server accepts, -1 for no limit */ #define CONFIG_MAXIMUM_TCP_CLIENT_CONNECTIONS 100 +/* set socket buffer size. 1 -> enable */ +#define CONFIG_SET_SOCKET_BUFSIZE 0 + +/* size (in KB) SOCKET RCVBUF */ +#define CONFIG_SOCKET_RCVBUFSIZE 512 + +/* size (in KB) SOCKET SNDBUF */ +#define CONFIG_SOCKET_SNDBUFSIZE 512 + /* activate TCP keep alive mechanism. 1 -> activate */ #define CONFIG_ACTIVATE_TCP_KEEPALIVE 1 diff --git a/hal/socket/win32/socket_win32.c b/hal/socket/win32/socket_win32.c index 65be99d7..e8e81e60 100644 --- a/hal/socket/win32/socket_win32.c +++ b/hal/socket/win32/socket_win32.c @@ -160,6 +160,14 @@ setSocketNonBlocking(Socket self) setsockopt(self->fd, IPPROTO_TCP, TCP_NODELAY, (const char*)&tcpNoDelay, sizeof(int)); } +static void +setSocketBufferSize(Socket self, int rcvBufSize, int sndBufSize) +{ + setsockopt(self->fd, SOL_SOCKET, SO_RCVBUF, (const char*)&rcvBufSize, sizeof(int)); + setsockopt(self->fd, SOL_SOCKET, SO_SNDBUF, (const char*)&sndBufSize, sizeof(int)); +} + + static bool prepareAddress(const char *address, int port, struct sockaddr_in *sockaddr) { @@ -265,6 +273,7 @@ TcpServerSocket_create(const char* address, int port) serverSocket->backLog = 10; setSocketNonBlocking((Socket)serverSocket); + //setSocketBufferSize((Socket)serverSocket, 512*1024, 512*1024); socketCount++; } @@ -296,6 +305,7 @@ ServerSocket_accept(ServerSocket self) socketCount++; setSocketNonBlocking(conSocket); + //setSocketBufferSize(conSocket, 512*1024, 512*1024); if (DEBUG_SOCKET) printf("WIN32_SOCKET: connection accepted\n"); @@ -413,6 +423,7 @@ Socket_connectAsync(Socket self, const char* address, int port) return false; setSocketNonBlocking(self); + //setSocketBufferSize(self, 512*1024, 512*1024); if (connect(self->fd, (struct sockaddr *) &serverAddress, sizeof(serverAddress)) == SOCKET_ERROR) { if (WSAGetLastError() != WSAEWOULDBLOCK) {