Why does my perl server stop working when i press 'enter'?
- by David
I have created a server in perl that sends messages or commands to the client. I can send commands just fine, but when i am being prompted for the command on my server i have created, if i press 'enter', the server messes up. Why is this happening?
Here is part of my code:
print "\nConnection recieved from IP address $peer_address on port $peer_port ";
    $closed_message = "\n\tTerminated client session...";
 while (1)
 {
     print "\nCommand: ";
     $send_data = <STDIN>;
     chop($send_data); 
     if ($send_data eq 'e' or $send_data eq 'E' or $send_data eq ' E' or $send_data eq ' E ' or $send_data eq 'E ' or $send_data eq ' e' or $send_data eq ' e ' or $send_data eq 'e')
        {
        $client_socket->send ($send_data);
        close $client_socket;
        print "$closed_message\n";
        &options;
        }
     else
        {
        $client_socket->send($send_data);
        }
        $client_socket->recv($recieved_data,8000);
        print "\nRecieved: $recieved_data";
}
}