mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
removed MySocketTCP.cpp
This commit is contained in:
@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
//version 1.0, base development, Ian 19/01/09
|
|
||||||
|
|
||||||
|
|
||||||
#include "MySocketTCP.h"
|
|
||||||
#include <string.h>
|
|
||||||
#include <iostream>
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int MySocketTCP::SendData(void* buf,int length){//length in characters
|
|
||||||
int ndata = SendDataAndKeepConnection(buf,length);
|
|
||||||
Disconnect();
|
|
||||||
return ndata;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MySocketTCP::SendDataAndKeepConnection(void* buf,int length){//length in characters
|
|
||||||
if(last_keep_connection_open_action_was_a_send) Disconnect(); //to keep a structured data flow;
|
|
||||||
|
|
||||||
Connect();
|
|
||||||
int total_sent=SendDataOnly(buf,length);
|
|
||||||
last_keep_connection_open_action_was_a_send=1;
|
|
||||||
return total_sent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int MySocketTCP::ReceiveData(void* buf,int length){//length in characters
|
|
||||||
int ndata = ReceiveDataAndKeepConnection(buf,length);
|
|
||||||
Disconnect();
|
|
||||||
return ndata;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MySocketTCP::ReceiveDataAndKeepConnection(void* buf,int length){//length in characters
|
|
||||||
if(!last_keep_connection_open_action_was_a_send) Disconnect(); //to a keep structured data flow;
|
|
||||||
|
|
||||||
Connect();
|
|
||||||
// should preform two reads one to receive incomming char count
|
|
||||||
int total_received=ReceiveDataOnly(buf,length);
|
|
||||||
last_keep_connection_open_action_was_a_send=0;
|
|
||||||
return total_received;
|
|
||||||
}
|
|
||||||
|
|
@ -41,27 +41,9 @@ developed and
|
|||||||
class MySocketTCP: public genericSocket {
|
class MySocketTCP: public genericSocket {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MySocketTCP(const char* const host_ip_or_name, unsigned short int const port_number): genericSocket(host_ip_or_name, port_number,TCP), last_keep_connection_open_action_was_a_send(0){setPacketSize(TCP_PACKET_SIZE);}; // sender (client): where to? ip
|
MySocketTCP(const char* const host_ip_or_name, unsigned short int const port_number): genericSocket(host_ip_or_name, port_number,TCP){setPacketSize(TCP_PACKET_SIZE);}; // sender (client): where to? ip
|
||||||
MySocketTCP(unsigned short int const port_number):genericSocket(port_number,TCP), last_keep_connection_open_action_was_a_send(0) {setPacketSize(TCP_PACKET_SIZE);}; // receiver (server) local no need for ip
|
MySocketTCP(unsigned short int const port_number):genericSocket(port_number,TCP) {setPacketSize(TCP_PACKET_SIZE);}; // receiver (server) local no need for ip
|
||||||
virtual ~MySocketTCP(){};
|
virtual ~MySocketTCP(){};
|
||||||
|
|
||||||
//The following two functions will connectioned->send/receive->disconnect
|
|
||||||
int SendData(void* buf,int length);//length in characters
|
|
||||||
int ReceiveData(void* buf,int length);
|
|
||||||
|
|
||||||
|
|
||||||
//The following two functions stay connected, blocking other connections, and must be manually disconnected,
|
|
||||||
// when the last call is a SendData() or ReceiveData() the disconnection will be done automatically
|
|
||||||
//These function will also automatically disconnect->reconnect if
|
|
||||||
// two reads (or two writes) are called in a row to preserve the data send/receive structure
|
|
||||||
int SendDataAndKeepConnection(void* buf,int length);
|
|
||||||
int ReceiveDataAndKeepConnection(void* buf,int length);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
bool last_keep_connection_open_action_was_a_send;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ LDIR = ../../slsDetectorSoftware
|
|||||||
RDIR = ../../slsReceiverSoftware
|
RDIR = ../../slsReceiverSoftware
|
||||||
DDIR = ../../bin
|
DDIR = ../../bin
|
||||||
INCLUDES = -I ../../commonFiles -I $(LDIR)/slsDetector -I ../include -I $(RDIR)/include
|
INCLUDES = -I ../../commonFiles -I $(LDIR)/slsDetector -I ../include -I $(RDIR)/include
|
||||||
SRC_CLNT = qClient.cpp $(RDIR)/src/MySocketTCP.cpp
|
SRC_CLNT = qClient.cpp
|
||||||
DEPSINCLUDES= qClient.h $(RDIR)/include/MySocketTCP.h $(LDIR)/slsDetector/slsDetectorBase.h ../../commonFiles/sls_detector_defs.h
|
DEPSINCLUDES= qClient.h $(RDIR)/include/MySocketTCP.h $(LDIR)/slsDetector/slsDetectorBase.h ../../commonFiles/sls_detector_defs.h
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ INCLUDES?= -I../commonFiles -IslsDetector -ImultiSlsDetector -IslsReceiverInte
|
|||||||
LIBZMQDIR = ../commonFiles
|
LIBZMQDIR = ../commonFiles
|
||||||
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
||||||
|
|
||||||
SRC_CLNT= slsDetector/slsDetectorCommand.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsReceiverInterface/receiverInterface.cpp slsDetector/slsDetectorUsers.cpp sharedMemory/SharedMemory.cpp ../commonFiles/utilities.cpp#../slsReceiverSoftware/MySocketTCP/MySocketTCP.cpp
|
SRC_CLNT= slsDetector/slsDetectorCommand.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsReceiverInterface/receiverInterface.cpp slsDetector/slsDetectorUsers.cpp sharedMemory/SharedMemory.cpp ../commonFiles/utilities.cpp
|
||||||
DEPSINCLUDES = ../commonFiles/sls_receiver_defs.h ../commonFiles/sls_receiver_funcs.h ../commonFiles/ansi.h ../commonFiles/sls_detector_defs.h ../commonFiles/sls_detector_funcs.h ../commonFiles/error_defs.h slsDetector/slsDetectorBase.h slsDetector/detectorData.h sharedMemory/SharedMemory.h ../commonFiles/sls_receiver_exceptions.h ../commonFiles/versionAPI.h ../commonFiles/utilities.h ../slsSupportLib/include/container_utils.h
|
DEPSINCLUDES = ../commonFiles/sls_receiver_defs.h ../commonFiles/sls_receiver_funcs.h ../commonFiles/ansi.h ../commonFiles/sls_detector_defs.h ../commonFiles/sls_detector_funcs.h ../commonFiles/error_defs.h slsDetector/slsDetectorBase.h slsDetector/detectorData.h sharedMemory/SharedMemory.h ../commonFiles/sls_receiver_exceptions.h ../commonFiles/versionAPI.h ../commonFiles/utilities.h ../slsSupportLib/include/container_utils.h
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
set(SOURCES
|
set(SOURCES
|
||||||
src/MySocketTCP.cpp
|
|
||||||
src/UDPInterface.cpp
|
src/UDPInterface.cpp
|
||||||
src/UDPBaseImplementation.cpp
|
src/UDPBaseImplementation.cpp
|
||||||
src/UDPStandardImplementation.cpp
|
src/UDPStandardImplementation.cpp
|
||||||
|
@ -26,7 +26,7 @@ LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
SRC_CLNT = MySocketTCP.cpp ThreadObject.cpp Listener.cpp DataProcessor.cpp DataStreamer.cpp Fifo.cpp File.cpp BinaryFile.cpp UDPInterface.cpp UDPBaseImplementation.cpp UDPStandardImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp $(COMMONDIR)/utilities.cpp
|
SRC_CLNT = ThreadObject.cpp Listener.cpp DataProcessor.cpp DataStreamer.cpp Fifo.cpp File.cpp BinaryFile.cpp UDPInterface.cpp UDPBaseImplementation.cpp UDPStandardImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp $(COMMONDIR)/utilities.cpp
|
||||||
DEPSINCLUDES = $(COMMONDIR)/ansi.h $(COMMONDIR)/sls_receiver_defs.h $(COMMONDIR)/sls_receiver_funcs.h $(COMMONDIR)/GeneralData.h $(INCDIR)/circularFifo.h $(COMMONDIR)/genericSocket.h $(COMMONDIR)/logger.h $(INCDIR)/receiver_defs.h $(INCDIR)/UDPInterface.h $(COMMONDIR)/utilities.h $(COMMONDIR)/ZmqSocket.h $(INCDIR)/BinaryFileStatic.h $(INCDIR)/HDF5FileStatic.h $(COMMONDIR)/sls_receiver_exceptions.h
|
DEPSINCLUDES = $(COMMONDIR)/ansi.h $(COMMONDIR)/sls_receiver_defs.h $(COMMONDIR)/sls_receiver_funcs.h $(COMMONDIR)/GeneralData.h $(INCDIR)/circularFifo.h $(COMMONDIR)/genericSocket.h $(COMMONDIR)/logger.h $(INCDIR)/receiver_defs.h $(INCDIR)/UDPInterface.h $(COMMONDIR)/utilities.h $(COMMONDIR)/ZmqSocket.h $(INCDIR)/BinaryFileStatic.h $(INCDIR)/HDF5FileStatic.h $(COMMONDIR)/sls_receiver_exceptions.h
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user