I am trying to send and receive requests to the same socket in the following fashion.
-
1) open socket
-
2) send LOGINPDU,
-
3) recv response from server and if ok send TRANSPDU
-
4) recv response from server
-
5) send LOGOUTPDU.
#Sample of what am trying to do below:
my $sock = IO::Socket::INET->new( Proto=> "tcp", PeerAddr => "$IP",
PeerPort => "$port") || die "Could not connect to host => $IP:
+$port \n";
print $sock $LOGINPDU."\n";
while($ans=<$sock>){
$ans1.=$ans;
}
$sock->flush();
if($ans1){
print $sock $transPDU."\n";
while($tns=<$sock>){
$tns.=$tns;
}
}
$sock->close();
The problem is that am only receiving response for the first request. Am not receiving response for the second pdu