in reply to Re^3: Client-Server Programme hangs...
in thread Client-Server Programme hangs...

Hello Errto,
Thanks for your last suggestions I have implemented all that you said but it really did not help, to resolve the issue. It's still hanging...

sub host_to_user { + my $nread ; my $inp ; $/ = CRLF ; while (<$socket>) { chomp; + my @data = split/-/, $_ ; print $_ , "\n"; print "The first value is $data[1]\n"; if ($data[1] eq 'THISISTHEEND') { $socket->close ; print " I have executed the close\n"; return 0 ; } } # + $socket->close ; #<- position 2 ###print " I have executed the close\n"; # return ; }

The output is still the same the following is the output of the above code.

$ ./client Testing> Hello I have received your message[server]-THISISTHEEND The first value is THISISTHEEND I have executed the close Testing> So what ^C$ $

I even tried to put the $socket->close () in what I mentioned as position 2, but that was worse and the execution never got to the close section so I took it out.

Replies are listed 'Best First'.
Re^5: Client-Server Programme hangs...
by Errto (Vicar) on Jan 05, 2005 at 03:33 UTC
    Then my only suggestion is to put some print statements in your server code, run it in a terminal, and make sure that the loop reading from $session actually exits when it should.