my $buf; while ( read(STDIN, $buf, 128) ) { print SOCKET, $buf; } #### # open up our pipe and turn off the default buffering open AUDIO_OUT, "|/usr/bin/aplay -f S32_BE -r22050 -c2 --buffer-time=500000 -" or die "aplay pipe broken\n"; select(AUDIO_OUT); $| = 1; select(STDOUT); my $stream; # these 2 lines are an attempt to fill up aplay's buffer # it doesn't appear to work at all read(CLIENT, $stream, 512); print AUDIO_OUT $stream; # read the stream and dump it out to aplay while ( defined( $stream = ) ) { print AUDIO_OUT $stream; }