Streen has asked for the wisdom of the Perl Monks concerning the following question:
The problem is the line: AdminFunctions::MainCall($clientHandle); I want to put the client in the module, so that part of the communication is in this case in the "AdminFunctions.pm". in the Module for example the MainCall Function is: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 id +entify 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 = <Client>; 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;
The program runs until it hits the line: "print $clientHandle" after that no error message is displayed and the program stops. How could i relaize this problem? What are my faults? I hope my english is not as bad as I think, its been a long time since I wrote a text in english (which is not my native language) regards Streen Edit: Repasted the code for better reading, sorry it was so unreadablesub MainCall { $ClientHandle = shift @_; Messages::PrintToLog("Admin: MainCall"); print $ClientHandle "Testing"; my $Answer = <$ClientHandle>; #some more function calls }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Socket Client to Module
by shmem (Chancellor) on Dec 04, 2006 at 16:31 UTC | |
by Streen (Sexton) on Dec 04, 2006 at 18:18 UTC | |
|
Re: Socket Client to Module
by grep (Monsignor) on Dec 04, 2006 at 16:25 UTC | |
by Streen (Sexton) on Dec 04, 2006 at 18:16 UTC | |
|
Re: Socket Client to Module
by Joost (Canon) on Dec 04, 2006 at 16:34 UTC | |
|
Re: Socket Client to Module
by liverpole (Monsignor) on Dec 04, 2006 at 16:36 UTC |