How would one implement a client that is continuously connected to the server, until a message like "goodbye" is keyed?else { # It's an established connection print "established s $s listener $listener\n"; print $listener "Why don't you call me anymore?\n" +; my $buf = <$s>; # Try to read a line # Was there anyone on the other end? if( defined $buf ) { # If they said goodbye, close the socket. +If not, # echo what they said to us. if ($buf =~ /goodbye/i) { print $s "See you later!\n"; $readable->remove($s); $s->close; } else { print $s "You said: $buf\n"; }
In reply to Re: Re: Two way socket
by Anonymous Monk
in thread Two way socket
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |