From 6e952aa069f0a78d6f784d4c132969a2bb63acb7 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 19 Apr 2005 18:33:29 +0000 Subject: Server part works again. --- src/miav.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/miav.cc') diff --git a/src/miav.cc b/src/miav.cc index cfd8770..c441dca 100644 --- a/src/miav.cc +++ b/src/miav.cc @@ -40,6 +40,7 @@ enum { MODE_SERVER }; + /** * This function starts the MIaV gui. */ @@ -55,6 +56,7 @@ int grab(int argc, char *argv[]) { #endif /* USE_GUI */ } + /** * This function starts the MIaV server. */ @@ -71,11 +73,11 @@ int server(int argc, char *argv[]) { } printf("Listening on port %d\n",atoi(argv[0])); - Socket *s = new Socket(atoi(argv[0])); + Socket *socket = new Socket(atoi(argv[0])); while(1) { - Socket *sc = new Socket(s->slisten()); - if(sc->isConnected()) { + Socket *csocket = new Socket(socket->slisten()); + if(csocket->isConnected()) { childpid = fork(); if(childpid == -1) { @@ -84,16 +86,16 @@ int server(int argc, char *argv[]) { exit(1); } else if(childpid == 0) { // fork() returns 0 to the child process - delete s; // Close listen socket. - newConnection(sc); - delete sc; // Close communication socket. + delete socket; // Close listen socket. + newConnection(csocket); + delete csocket; // Close communication socket. exit(0); } else { // fork() returns new pid to the parent process } } } - delete s; + delete socket; return 0; } -- cgit v1.2.3