if(open_con(F,"localhost","port")) { $text = "some expression to be send to the server"; syswrite(F,$text,500); open(AUDIO,">$audio_file); $receive = ; // instead of sysread(F,$receive,500) while($receive = ) { print AUDIO $receive; } close AUDIO; }