This commit is contained in:
Dhanya Maliakal
2016-10-31 14:53:58 +01:00
parent 78cfbb92d8
commit bd74a25072
2 changed files with 7 additions and 3 deletions

View File

@ -617,8 +617,10 @@ enum communicationProtocol{
while(length>0){ while(length>0){
if(length<packet_size) if(length<packet_size)
nsending = length; //works for jungfrau to read packet header nsending = length; //works for jungfrau to read packet header
else else{
cprintf(BG_RED,"should not be here, wrong nsending\n");
nsending = (length>packet_size) ? packet_size:length; //works for eiger to get packets to discard image header packets nsending = (length>packet_size) ? packet_size:length; //works for eiger to get packets to discard image header packets
}
nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length); nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length);
cout<<"nsent:"<<nsent<<endl; cout<<"nsent:"<<nsent<<endl;
if(nsent != nsending){ //if((nsent != nsending)){ && (nsent < packet_size)){ if(nsent != nsending){ //if((nsent != nsending)){ && (nsent < packet_size)){
@ -632,6 +634,7 @@ enum communicationProtocol{
} }
//listens to only 1 packet //listens to only 1 packet
else{ else{
cprintf(BG_RED,"should not be here, length is zero\n");
//normal //normal
nsending=packet_size; nsending=packet_size;
nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length); nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length);
@ -642,9 +645,9 @@ enum communicationProtocol{
default: default:
; ;
} }
#ifdef VERY_VERBOSE //#ifdef VERY_VERBOSE
cout << "sent "<< total_sent << " Bytes" << endl; cout << "sent "<< total_sent << " Bytes" << endl;
#endif //#endif
return total_sent; return total_sent;

View File

@ -2160,6 +2160,7 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
receivedSize = oneDataSize * packetsPerFrame; receivedSize = oneDataSize * packetsPerFrame;
} }
else{ else{
cprintf(BG_RED,"should not be here, wrong det\n");
receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + fifoBufferHeaderSize + cSize, (bufferSize * numberofJobsPerBuffer) - cSize); receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + fifoBufferHeaderSize + cSize, (bufferSize * numberofJobsPerBuffer) - cSize);
//eiger returns 0 when header packet caught //eiger returns 0 when header packet caught
while(receivedSize < onePacketSize && status != TRANSMITTING) while(receivedSize < onePacketSize && status != TRANSMITTING)