diff --git a/slsDetectorSoftware/MySocketTCP/MySocketTCP.h b/slsDetectorSoftware/MySocketTCP/MySocketTCP.h index 66c742184..31f56d453 100644 --- a/slsDetectorSoftware/MySocketTCP/MySocketTCP.h +++ b/slsDetectorSoftware/MySocketTCP/MySocketTCP.h @@ -53,8 +53,8 @@ developed and class MySocketTCP: public genericSocket { 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(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(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(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 //The following two functions will connectioned->send/receive->disconnect diff --git a/slsDetectorSoftware/MySocketTCP/genericSocket.h b/slsDetectorSoftware/MySocketTCP/genericSocket.h index 671efe44c..cb0a3d219 100644 --- a/slsDetectorSoftware/MySocketTCP/genericSocket.h +++ b/slsDetectorSoftware/MySocketTCP/genericSocket.h @@ -89,7 +89,7 @@ enum communicationProtocol{ }; - genericSocket(const char* const host_ip_or_name, unsigned short int const port_number, communicationProtocol p) : + genericSocket(const char* const host_ip_or_name, unsigned short int const port_number, communicationProtocol p) : // portno(port_number), protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(DEFAULT_PACKET_SIZE)// sender (client): where to? ip { @@ -138,7 +138,7 @@ protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(DEFA */ - genericSocket(unsigned short int const port_number, communicationProtocol p, const char *eth=NULL): + genericSocket(unsigned short int const port_number, communicationProtocol p, const char *eth=NULL): //portno(port_number), protocol(p), is_a_server(1),socketDescriptor(-1), file_des(-1), packet_size(DEFAULT_PACKET_SIZE){ diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index b13a51359..eea3b8850 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -4449,7 +4449,6 @@ int slsDetector::exitServer(){ char* slsDetector::setNetworkParameter(networkParameter index, string value) { - char* answer; int i; switch (index) { @@ -4465,8 +4464,8 @@ char* slsDetector::setNetworkParameter(networkParameter index, string value) { return setReceiverUDPMAC(value); case RECEIVER_UDP_PORT: sscanf(value.c_str(),"%d",&i); - sprintf(answer,"%d",setReceiverUDPPort(i)); - return answer; + setReceiverUDPPort(i); + return getReceiverUDPPort(); default: return ("unknown network parameter"); } diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 4fff5b2fc..1caa11105 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -2244,8 +2244,10 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio t=RECEIVER_UDP_MAC; } else if (cmd=="rx_udpport") { t=RECEIVER_UDP_PORT; - if (!(sscanf(args[1],"%d",&i))) - return ("cannot parse argument") + string(args[1]); + if (action==PUT_ACTION){ + if (!(sscanf(args[1],"%d",&i))) + return ("cannot parse argument") + string(args[1]); + } } else return ("unknown network parameter")+cmd; if (action==PUT_ACTION)