separated

This commit is contained in:
Dhanya Maliakal
2016-08-31 17:23:44 +02:00
parent fbf6e2bff1
commit a3369a7d21
7 changed files with 205 additions and 181 deletions

View File

@@ -398,12 +398,13 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
/**
* Get the buffer-current frame read by receiver
* @param ithread port thread index
* @param c pointer to current file name
* @param raw address of pointer, pointing to current frame to send to gui
* @param startAcq start index of the acquisition
* @param startFrame start index of the scan
*/
void readFrame(char* c,char** raw, uint64_t &startAcq, uint64_t &startFrame);
void readFrame(int ithread, char* c,char** raw, int64_t &startAcq, int64_t &startFrame);
/**
* abort acquisition with minimum damage: close open files, cleanup.

View File

@@ -455,12 +455,13 @@ class UDPInterface {
/**
* Get the buffer-current frame read by receiver
* @param ithread port thread index
* @param c pointer to current file name
* @param raw address of pointer, pointing to current frame to send to gui
* @param startAcq start index of the acquisition
* @param startFrame start index of the scan
*/
virtual void readFrame(char* c,char** raw, uint64_t &startAcq, uint64_t &startFrame)=0;
virtual void readFrame(int ithread, char* c,char** raw, int64_t &startAcq, int64_t &startFrame)=0;
/**
* abort acquisition with minimum damage: close open files, cleanup.

View File

@@ -218,7 +218,7 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
* @param startAcq start index of the acquisition
* @param startFrame start index of the scan
*/
void readFrame(int ithread, char* c,char** raw, uint64_t &startAcq, uint64_t &startFrame);
void readFrame(int ithread, char* c,char** raw, int64_t &startAcq, int64_t &startFrame);
/**
* Overridden method
@@ -571,8 +571,6 @@ private:
/** Previous Frame number from buffer to calculate loss */
int64_t frameNumberInPreviousFile[MAX_NUMBER_OF_WRITER_THREADS];
/** Last Frame Index Listened To */
int64_t lastFrameIndex[MAX_NUMBER_OF_WRITER_THREADS];
@@ -586,7 +584,7 @@ private:
int totalListeningPacketCount[MAX_NUMBER_OF_LISTENING_THREADS];
/** Pckets currently in current file, starts new file when it reaches max */
uint64_t lastFrameNumberInFile[MAX_NUMBER_OF_WRITER_THREADS];
int64_t lastFrameNumberInFile[MAX_NUMBER_OF_WRITER_THREADS];
/** packets in current file */
uint64_t totalPacketsInFile[MAX_NUMBER_OF_WRITER_THREADS];

View File

@@ -3,7 +3,7 @@
#define GENERIC_SOCKET_H
#include "ansi.h"
/**
@@ -105,7 +105,8 @@ enum communicationProtocol{
packet_size(ps),
nsending(0),
nsent(0),
total_sent(0)// sender (client): where to? ip
total_sent(0),// sender (client): where to? ip
header_packet_size(0)
{
//memset(&serverAddress, 0, sizeof(sockaddr_in));
//memset(&clientAddress, 0, sizeof(sockaddr_in));
@@ -161,7 +162,7 @@ enum communicationProtocol{
*/
genericSocket(unsigned short int const port_number, communicationProtocol p, int ps = DEFAULT_PACKET_SIZE, const char *eth=NULL):
genericSocket(unsigned short int const port_number, communicationProtocol p, int ps = DEFAULT_PACKET_SIZE, const char *eth=NULL, int hsize=0):
//portno(port_number),
protocol(p),
is_a_server(1),
@@ -170,7 +171,8 @@ enum communicationProtocol{
packet_size(ps),
nsending(0),
nsent(0),
total_sent(0)
total_sent(0),
header_packet_size(hsize)
{
/* // you can specify an IP address: */
@@ -616,7 +618,8 @@ enum communicationProtocol{
nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length);
if(nsent < packet_size) {
if(nsent){
cout << "Incomplete Packet size " << nsent << endl;
if(nsent != header_packet_size)
cprintf(RED,"Incomplete Packet size %d\n",nsent);
}
break;
}
@@ -690,6 +693,11 @@ enum communicationProtocol{
}
int getCurrentTotalReceived(){
return total_sent;
}
char lastClientIP[INET_ADDRSTRLEN];
char thisClientIP[INET_ADDRSTRLEN];
int differentClients;
@@ -712,7 +720,7 @@ enum communicationProtocol{
int nsending;
int nsent;
int total_sent;
int header_packet_size;
// pthread_mutex_t mp;