Hi guys, I have a socket set up with IO::Socket::INET. It works in that I am able to write to the socket, however I can't capture what the remote host sends back. I just get nothing. I know the connection works, because I can use telnet to drive the dialogue manually and when I send the 'status' request, I get a dump of data back. How can I get my socket to capture this so that I can do something useful with it? Here's a snip of the code I'm using:
my $sock = new IO::Socket::INET ( PeerAddr => "$hostname", PeerPort => "$port", Blocking => 0, Proto => 'tcp', ); print $sock "Action: Login\r\n"; print $sock "UserName: $foo\r\n"; print $sock "Secret: $bar\r\n\r\n"; print $sock "Action: status\r\n\r\n"; $/="\r\n"; open(FH,">>/home/chris/statusdump.txt"); while(my $data=<$sock>){ $data =~ /[a-z]/ || next; print FH $data; } close FH;
I have opened up the permissions on that temporary file and I'm tail -f'ing it to see what comes in, but the file doesn't grow at all. What's the obvious mistake please? thanks christo

In reply to Problems reading back from socket by planet_guru

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.