server locking flag (not real lock), last client vs this client, change port implemented, most funcs of the multidetector implemented again

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@64 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi
2011-11-25 15:33:25 +00:00
parent f1654363e0
commit 4cbd9b2265
14 changed files with 1958 additions and 1388 deletions

View File

@ -5,7 +5,7 @@
#include <stdlib.h>
int sockfd;
extern int sockfd;
void error(char *msg)
@ -18,6 +18,8 @@ int main(int argc, char *argv[])
int portno, b;
char cmd[100];
int retval=OK;
int sd, fd;
if (argc==1) {
portno = DEFAULT_PORTNO;
@ -37,8 +39,12 @@ int main(int argc, char *argv[])
init_detector(b);
bindSocket(portno);
if (getServerError()) {
sd=bindSocket(portno);
sockfd=sd;
if (getServerError(sd)) {
printf("server error!\n");
return -1;
}
@ -58,21 +64,21 @@ int main(int argc, char *argv[])
#ifdef VERY_VERBOSE
printf("Waiting for client call\n");
#endif
acceptConnection();
fd=acceptConnection(sockfd);
#ifdef VERY_VERBOSE
printf("Conenction accepted\n");
#endif
retval=decode_function();
#ifdef VERY_VERBOSE
retval=decode_function(fd);
//#ifdef VERY_VERBOSE
printf("function executed\n");
#endif
closeConnection();
//#endif
closeConnection(fd);
#ifdef VERY_VERBOSE
printf("connection closed\n");
#endif
}
exitServer();
exitServer(sockfd);
printf("Goodbye!\n");
return 0;