my $oSocket = IO::Socket::INET->new(PeerAddr => $HostName, PeerPort => $Port, Proto => "tcp", Timeout => $SocketTimeout, Type => 'SOCK_STREAM'); my $sSend = " " . "" . $ConnectionString . "" . ""; my $sRet=""; eval { local *FH = $oSocket; print FH $sSend; my $data_read; #read the response while (recv(FH, $data_read, 4096,0)) { $sRet .= $data_read; last if ($data_read =~ /<\/xml>/i); } }; die if (length($sRet) == 0)