From d1a3cf8ed8f73e03ba919254c40ffe6dd3eef120 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 6 Aug 2013 14:02:22 +0000 Subject: [PATCH] changing socket buffer size git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@645 951219d9-93cf-4727-9268-0efd64621fa3 --- slsDetectorSoftware/MySocketTCP/genericSocket.h | 8 ++++++++ slsDetectorSoftware/commonFiles/sls_detector_defs.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/slsDetectorSoftware/MySocketTCP/genericSocket.h b/slsDetectorSoftware/MySocketTCP/genericSocket.h index 00d5dc497..3a0a005fd 100644 --- a/slsDetectorSoftware/MySocketTCP/genericSocket.h +++ b/slsDetectorSoftware/MySocketTCP/genericSocket.h @@ -221,6 +221,14 @@ enum communicationProtocol{ socketDescriptor=-1; return; } + + //increase buffer size if its udp + if((communicationProtocol == UDP) && (setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &SOCKET_BUFFER_SIZE, sizeof(int)) == -1)) + { + cerr << "Cannot set socket receive buffer size" << endl; + } + + if (getProtocol()==SOCK_STREAM) listen(socketDescriptor, DEFAULT_BACKLOG); diff --git a/slsDetectorSoftware/commonFiles/sls_detector_defs.h b/slsDetectorSoftware/commonFiles/sls_detector_defs.h index 10c704b2b..3f8cc44f9 100755 --- a/slsDetectorSoftware/commonFiles/sls_detector_defs.h +++ b/slsDetectorSoftware/commonFiles/sls_detector_defs.h @@ -19,6 +19,8 @@ #define MAXDET 100 /** header length for data :gotthard*/ #define HEADERLENGTH 12 +/** udp socket buffer size - 100MB*/ +#define SOCKET_BUFFER_SIZE (100*1024*1024) /** maximum rois */ #define MAX_ROIS 100