mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 07:01:33 +01:00
included settting up of udpport from client and getting receiver mac from receiver and also listening to only one ethernet interface
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@371 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "receiverInterface.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -44,6 +43,29 @@ int receiverInterface::sendString(int fnum, char retval[], char arg[]){
|
||||
|
||||
|
||||
|
||||
int receiverInterface::sendUDPDetails(int fnum, char retval[], char arg[2][MAX_STR_LENGTH]){
|
||||
char args[2][MAX_STR_LENGTH];
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[100] = "";
|
||||
|
||||
if (dataSocket) {
|
||||
if (dataSocket->Connect()>=0) {
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(arg,sizeof(args));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Receiver returned error: " << mess << std::endl;
|
||||
}
|
||||
else
|
||||
dataSocket->ReceiveDataOnly(retval,MAX_STR_LENGTH);
|
||||
}
|
||||
dataSocket->Disconnect();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int receiverInterface::sendInt(int fnum, int &retval, int arg){
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[100] = "";
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#ifndef SLS_RECEIVER_INTERFACE_H
|
||||
#define SLS_RECEIVER_INTERFACE_H
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
#include "MySocketTCP.h"
|
||||
|
||||
|
||||
@@ -48,6 +49,15 @@ public:
|
||||
*/
|
||||
int sendString(int fnum, char retval[], char arg[]);
|
||||
|
||||
/**
|
||||
* Send a string to receiver
|
||||
* @param fnum function enum to send udp ip and udp port
|
||||
* @param retval return value receiver mac
|
||||
* @param arg value to send
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendUDPDetails(int fnum, char retval[], char arg[2][MAX_STR_LENGTH]);
|
||||
|
||||
|
||||
/**
|
||||
* Send an integer to receiver
|
||||
|
||||
Reference in New Issue
Block a user