while (($Timeout eq "false") && accept(Client, Server)) { #Server may run and a connection to a client has been found Messages::PrintToLog("Client Connected\n"); my $clientHandle = getpeername (Client) or print "Could not identify Client: $!\n"; my ($port, $iaddr) = unpack_sockaddr_in($clientHandle); my $clientIP = inet_ntoa($iaddr); Messages::PrintToLog("Client IP: $clientIP \n"); # Check which branch to go my $answer = ; if ($answer eq "AdminUserLogin\n") { print Client "test"; AdminFunctions::MainCall($clientHandle); #$Timeout = "true"; } elsif($answer eq "ShutDown\n") { #DEBUG ONLY $Timeout = "true"; } Messages::PrintToLog("Got something from the Client: $answer"); Messages::PrintToLog("Closing Client.\n"); close Client; } Messages::PrintToLog("Closing Server.\n"); close Server; #### sub MainCall { $ClientHandle = shift @_; Messages::PrintToLog("Admin: MainCall"); print $ClientHandle "Testing"; my $Answer = <$ClientHandle>; #some more function calls }