mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 09:15:54 +01:00
done, but need to compile
This commit is contained in:
@@ -308,7 +308,7 @@ int receiveData(int file_des, void* buf,int length, intType itype){
|
||||
int ret = receiveDataOnly(file_des, buf, length);
|
||||
#ifndef PCCOMPILE
|
||||
#ifdef EIGERD
|
||||
swapData(buf, length, itype);
|
||||
if (ret >= 0) swapData(buf, length, itype);
|
||||
#endif
|
||||
#endif
|
||||
return ret;
|
||||
@@ -316,9 +316,9 @@ int receiveData(int file_des, void* buf,int length, intType itype){
|
||||
|
||||
|
||||
int sendDataOnly(int file_des, void* buf,int length) {
|
||||
|
||||
|
||||
return write(file_des, buf, length);
|
||||
int ret = write(file_des, buf, length); //value of -1 is other end socket crash as sigpipe is ignored
|
||||
if (ret < 0) cprintf(BG_RED, "Error writing to socket. Possible socket crash\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -332,33 +332,23 @@ int receiveData(int file_des, void* buf,int length, intType itype){
|
||||
printf("want to receive %d Bytes\n", length);
|
||||
//#endif
|
||||
|
||||
while(length>0){
|
||||
while(length > 0) {
|
||||
nreceiving = (length>send_rec_max_size) ? send_rec_max_size:length;
|
||||
|
||||
//#ifdef VERY_VERBOSE
|
||||
// printf("want to receive %d Bytes\n", nreceiving);
|
||||
//#endif
|
||||
nreceived = read(file_des,(char*)buf+total_received,nreceiving);
|
||||
//#ifdef VERY_VERBOSE
|
||||
// printf("read %d \n", nreceived);
|
||||
//#endif
|
||||
if(!nreceived) break;
|
||||
// if(nreceived<0) break;
|
||||
if(!nreceived){
|
||||
if(!total_received) {
|
||||
cprintf(BG_RED, "Error reading from socket. Possible socket crash\n");
|
||||
return -1; //to handle it
|
||||
}
|
||||
break;
|
||||
}
|
||||
length-=nreceived;
|
||||
total_received+=nreceived;
|
||||
// cout<<"nrec: "<<nreceived<<" waiting for ("<<length<<")"<<endl;
|
||||
}
|
||||
|
||||
//#ifdef VERY_VERBOSE
|
||||
// printf("received %d Bytes\n", total_received);
|
||||
//#endif
|
||||
|
||||
if (total_received>0)
|
||||
strcpy(thisClientIP,dummyClientIP);
|
||||
|
||||
//if (strcmp(lastClientIP,"none")==0)
|
||||
//strcpy(lastClientIP,thisClientIP);
|
||||
|
||||
if (strcmp(lastClientIP,thisClientIP))
|
||||
differentClients=1;
|
||||
else
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#ifndef SLS_DETECTOR_FUNCS_H
|
||||
#define SLS_DETECTOR_FUNCS_H
|
||||
|
||||
enum {
|
||||
enum detFuncs{
|
||||
|
||||
// General purpose functions
|
||||
F_EXEC_COMMAND=0, /**< command is executed */
|
||||
@@ -109,10 +109,13 @@ enum {
|
||||
F_PROGRAM_FPGA, /**< program FPGA */
|
||||
F_RESET_FPGA, /**< reset FPGA */
|
||||
F_POWER_CHIP, /**< power chip */
|
||||
F_ACTIVATE, /** < activate */
|
||||
F_PREPARE_ACQUISITION, /** < prepare acquisition */
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
/* Always append functions before!!! */
|
||||
TOO_MANY_FUNCTIONS_DEFINED=128 //you should get a compilation error if there are already so many functions defined. It conflicts with sls_receiver_funcs.h
|
||||
NUM_DET_FUNCTIONS,
|
||||
TOO_MANY_FUNCTIONS_DEFINED=127 //you should get a compilation error if there are already so many functions defined. It conflicts with sls_receiver_funcs.h
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user