in reply to Re: Two way socket
in thread Two way socket
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"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Two way socket
by pg (Canon) on Oct 16, 2003 at 05:47 UTC |