LJ Archive

Listing 1. Writing to the Festival Socket

#!/usr/bin/perl
#
# Write to the Festival server
# Marcel Gagné - 2001
#
$remote_port="1314";
$festival_host="localhost";
$my_message="Francois, come here.  I need you.";
use IO::Socket;
$socket = IO::Socket::INET->new
                      (PeerAddr => $festival_host,
                       PeerPort => $remote_port,
                       Proto    => "tcp",
                       Type     => SOCK_STREAM)
   or die "No connection to $remote_host:$remote_port  $@\n";
# Write to the Festival server port
if ($socket) {   # Just checking
   print($socket '(SayText "',$my_message,'")') or
        die "Is the Festival server running?\n";
        }
# Close the socket connection if it isn't already
close($socket);
LJ Archive