mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-13 07:52:12 +02:00
got rid of local host because pcname works on its own
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@427 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
5d88f249a4
commit
f6a3254c2f
@ -4610,12 +4610,6 @@ int slsDetector::setUDPConnection(){
|
|||||||
|
|
||||||
//if no udp ip given, use hostname
|
//if no udp ip given, use hostname
|
||||||
if(!strcmp(thisDetector->receiverUDPIP,"none")){
|
if(!strcmp(thisDetector->receiverUDPIP,"none")){
|
||||||
if(!strcmp(thisDetector->receiver_hostname,"localhost")){
|
|
||||||
string temp = genericSocket::ipToName("localhost");
|
|
||||||
strcpy(thisDetector->receiverUDPIP,temp.c_str());
|
|
||||||
temp = genericSocket::nameToMac(genericSocket::ipToName(temp));
|
|
||||||
strcpy(thisDetector->receiverUDPMAC,temp.c_str());
|
|
||||||
}else{
|
|
||||||
//hostname is an ip address
|
//hostname is an ip address
|
||||||
if(strchr(thisDetector->receiver_hostname,'.')!=NULL)
|
if(strchr(thisDetector->receiver_hostname,'.')!=NULL)
|
||||||
strcpy(thisDetector->receiverUDPIP,thisDetector->receiver_hostname);
|
strcpy(thisDetector->receiverUDPIP,thisDetector->receiver_hostname);
|
||||||
@ -4629,13 +4623,14 @@ int slsDetector::setUDPConnection(){
|
|||||||
strcpy(thisDetector->receiverUDPIP,inet_ntoa(*(struct in_addr*)he->h_addr));
|
strcpy(thisDetector->receiverUDPIP,inet_ntoa(*(struct in_addr*)he->h_addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//copy arguments to args[][]
|
//copy arguments to args[][]
|
||||||
strcpy(args[0],thisDetector->receiverUDPIP);
|
strcpy(args[0],thisDetector->receiverUDPIP);
|
||||||
sprintf(args[1],"%d",thisDetector->receiverUDPPort);
|
sprintf(args[1],"%d",thisDetector->receiverUDPPort);
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout << "Receiver ip address: " << thisDetector->receiverUDPIP << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
//set up receiver for UDP Connection and get receivermac address
|
//set up receiver for UDP Connection and get receivermac address
|
||||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||||
@ -4643,26 +4638,17 @@ int slsDetector::setUDPConnection(){
|
|||||||
std::cout << "Setting up UDP Connection for Receiver " << args[0] << "\t" << args[1] << std::endl;
|
std::cout << "Setting up UDP Connection for Receiver " << args[0] << "\t" << args[1] << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//already have mac address if localhost
|
|
||||||
if(!strcmp(thisDetector->receiver_hostname,"localhost"))
|
|
||||||
ret=OK;
|
|
||||||
|
|
||||||
//get mac address from receiver
|
|
||||||
else{
|
|
||||||
ret=thisReceiver->sendUDPDetails(fnum,retval,args);
|
ret=thisReceiver->sendUDPDetails(fnum,retval,args);
|
||||||
if(ret!=FAIL){
|
if(ret!=FAIL){
|
||||||
strcpy(thisDetector->receiverUDPMAC,retval);
|
strcpy(thisDetector->receiverUDPMAC,retval);
|
||||||
}
|
|
||||||
if(ret==FORCE_UPDATE)
|
|
||||||
updateReceiver();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Receiver mac address: " << thisDetector->receiverUDPMAC << std::endl;
|
std::cout << "Receiver mac address: " << thisDetector->receiverUDPMAC << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
if(ret==FORCE_UPDATE)
|
||||||
|
updateReceiver();
|
||||||
|
|
||||||
//configure detector with udp details
|
//configure detector with udp details
|
||||||
if(ret!=FAIL){
|
|
||||||
if(configureMAC()!=OK){
|
if(configureMAC()!=OK){
|
||||||
setReceiverOnline(OFFLINE_FLAG);
|
setReceiverOnline(OFFLINE_FLAG);
|
||||||
std::cout << "could not configure mac" << endl;
|
std::cout << "could not configure mac" << endl;
|
||||||
@ -4689,13 +4675,6 @@ int slsDetector::configureMAC(int adc){
|
|||||||
|
|
||||||
//if udpip wasnt initialized in config file
|
//if udpip wasnt initialized in config file
|
||||||
if(!(strcmp(thisDetector->receiverUDPIP,"none"))){
|
if(!(strcmp(thisDetector->receiverUDPIP,"none"))){
|
||||||
//if localhost
|
|
||||||
if(!strcmp(thisDetector->receiver_hostname,"localhost")){
|
|
||||||
string temp = genericSocket::ipToName("localhost");
|
|
||||||
strcpy(thisDetector->receiverUDPIP,temp.c_str());
|
|
||||||
temp = genericSocket::nameToMac(genericSocket::ipToName(temp));
|
|
||||||
strcpy(thisDetector->receiverUDPMAC,temp.c_str());
|
|
||||||
}else{
|
|
||||||
//hostname is an ip address
|
//hostname is an ip address
|
||||||
if(strchr(thisDetector->receiver_hostname,'.')!=NULL)
|
if(strchr(thisDetector->receiver_hostname,'.')!=NULL)
|
||||||
strcpy(thisDetector->receiverUDPIP,thisDetector->receiver_hostname);
|
strcpy(thisDetector->receiverUDPIP,thisDetector->receiver_hostname);
|
||||||
@ -4710,7 +4689,6 @@ int slsDetector::configureMAC(int adc){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
strcpy(arg[0],thisDetector->receiverUDPIP);
|
strcpy(arg[0],thisDetector->receiverUDPIP);
|
||||||
strcpy(arg[1],thisDetector->receiverUDPMAC);
|
strcpy(arg[1],thisDetector->receiverUDPMAC);
|
||||||
sprintf(arg[2],"%x",thisDetector->receiverUDPPort);
|
sprintf(arg[2],"%x",thisDetector->receiverUDPPort);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user