mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
made udp socket in receiver use generic socket, included a incrememnt frame index in acquire before a break, got rid of infinite loop for unmatched index in receiver
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@350 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -90,9 +90,6 @@ enum communicationProtocol{
|
||||
// portno(port_number),
|
||||
protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(DEFAULT_PACKET_SIZE)// sender (client): where to? ip
|
||||
{
|
||||
/* pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER; */
|
||||
/* mp=mp1; */
|
||||
/* pthread_mutex_init(&mp, NULL); */
|
||||
|
||||
// strcpy(hostname,host_ip_or_name);
|
||||
struct hostent *hostInfo = gethostbyname(host_ip_or_name);
|
||||
@ -346,9 +343,6 @@ protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(DEFA
|
||||
file_des = -1;
|
||||
} else{
|
||||
file_des = socketDescriptor;
|
||||
/*cout<<"locking"<<endl;
|
||||
pthread_mutex_lock(&mp);
|
||||
cout<<"locked"<<endl;*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -362,23 +356,31 @@ protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(DEFA
|
||||
|
||||
/** @short free connection */
|
||||
void Disconnect(){
|
||||
|
||||
if(file_des>=0){ //then was open
|
||||
if(is_a_server){
|
||||
close(file_des);
|
||||
if (protocol==UDP){
|
||||
close(socketDescriptor);
|
||||
socketDescriptor=-1;
|
||||
}
|
||||
else{
|
||||
if(file_des>=0){ //then was open
|
||||
if(is_a_server){
|
||||
close(file_des);
|
||||
}
|
||||
else {
|
||||
close(socketDescriptor);
|
||||
socketDescriptor=-1;
|
||||
}
|
||||
file_des=-1;
|
||||
}
|
||||
else {
|
||||
close(socketDescriptor);
|
||||
socketDescriptor=-1;
|
||||
}
|
||||
file_des=-1;
|
||||
/*cout<<"unlocking"<<endl;
|
||||
pthread_mutex_unlock(&mp);
|
||||
cout<<"unlocked"<<endl;*/
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void ShutDownSocket(){
|
||||
if (socketDescriptor != -1)
|
||||
shutdown(socketDescriptor, SHUT_RDWR);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** Set the socket timeout ts is in seconds */
|
||||
int SetTimeOut(int ts){
|
||||
|
Reference in New Issue
Block a user