edited generic socket for udp socket, prob:gap in files when using smaller buffers

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@357 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2012-11-22 13:55:37 +00:00
parent c02075dc12
commit a781ca3422
4 changed files with 11 additions and 8 deletions

View File

@ -515,8 +515,10 @@ protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(DEFA
break;
case UDP:
if (socketDescriptor<0) return -1;
while(length>0){
nsending = (length>packet_size) ? packet_size:length;
// while(length>0){
for(int i=0;i<2;i++){
nsending=packet_size;
//nsending = (length>packet_size) ? packet_size:length;
nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length);
if(!nsent) break;
length-=nsent;

View File

@ -37,6 +37,7 @@ int main(int argc, char *argv[])
if(ret==slsDetectorDefs::FAIL)
return -1;
#ifdef VERBOSE
cout << "Function table assigned." << endl;
#endif

View File

@ -111,7 +111,7 @@ void slsReceiverFunctionList::closeFile(int p){
cout << "Closing file and Exiting." << endl;
fclose(sfilefd);
}
exit(0);
//exit(0);
}

View File

@ -6,7 +6,7 @@
#include "slsReceiver_funcs.h"
#include "slsReceiverFunctionList.h"
#include <signal.h> // SIGINT
//#include <signal.h> //SIGINT
#include <iostream>
#include <string>
@ -15,6 +15,9 @@
using namespace std;
slsReceiverFuncs::slsReceiverFuncs(MySocketTCP *&mySocket,string const fname,int &success, bool shortfname):
socket(mySocket),
ret(OK),
@ -197,10 +200,7 @@ int slsReceiverFuncs::M_nofunc(){
/*
void slsReceiverFuncs::closeFile(int p){
//if(socket)
slsReceiverFunctionList::closeFile(0);
socket->Disconnect();//non static
delete socket;
exit(0);
slsReceiverFunctionList::closeFile();
}
*/