Obviously because your while loop never terminates. After reading the first line of input, the $line = <$remote> blocks, waiting for more input that never comes.

Three notes:
  1. You should use strict;
  2. I can't find any mention of an exit() method in the IO::Socket module documentation and it isn't strictly necessary either since IO::Socket will clean up after you at program termination (as do all well-behaved modules).
  3. Your autoflush() has no effect since you're not writing anything onto the socket that might get buffered in the first place.

Update: I think what you want to do is more like this:
#!/usr/bin/perl -w use strict; use IO::Socket; my $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "210.212.226.195", PeerPort => "ssh(22)", ) || die "cannot connect"; sysread($remote, my $line, 4*1024) or die "couldn't read any data"; # +one single attempt to read 4k of data print "$line\n";
____________
Makeshifts last the longest.

In reply to Re: how to terminate an IO:Socket Process prematurely? by Aristotle
in thread how to terminate an IO:Socket Process prematurely? by Anonymous Monk

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.