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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.