mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 15:57:13 +02:00
added a new function checkOnline to check individually if det is connected
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@243 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -908,6 +908,31 @@ int slsDetector::setOnline(int off) {
|
||||
|
||||
|
||||
|
||||
int slsDetector::checkOnline() {
|
||||
int retval=ONLINE_FLAG;
|
||||
if(!controlSocket)
|
||||
controlSocket= new MySocketTCP(thisDetector->hostname, thisDetector->controlPort);
|
||||
if (controlSocket->Connect()<0) {
|
||||
controlSocket->SetTimeOut(5);
|
||||
thisDetector->onlineFlag=OFFLINE_FLAG;
|
||||
delete controlSocket;
|
||||
controlSocket=NULL;
|
||||
retval=OFFLINE_FLAG;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "offline!" << std::endl;
|
||||
#endif
|
||||
} else {
|
||||
thisDetector->onlineFlag=ONLINE_FLAG;
|
||||
controlSocket->SetTimeOut(100);
|
||||
controlSocket->Disconnect();
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "online!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
configure the socket communication and check that the server exists
|
||||
|
Reference in New Issue
Block a user