Well, i tryed to use shutdown() but i`ve got same behavior but in other hand i could make it work but still have some small problems, take a look:
# ./client.pl Connected from: 127.0.0.1:33703 Command> >uname Linux Command> id nobody uid=99(nobody) gid=99(nogroup) groups=99(nogroup),98(nobody) Command>
That is ok, but in some commands (i dont know why) i can execute them sucessfully and them i`ve freeze again, look:
Command> touch test
And look what happens if i use ";" followed by some other command:
Command> touch test ; ls client.pl client.pl~ salvo.pl server.pl server.pl~ test Command>
Here is the code:
sub listen() { $local = IO::Socket::INET->new(Listen=>1, Proto=>'tcp', LocalAddr=>'eth0' LocalPort=>5000, ReuseAddr=>1,) or die "$!"; $local->autoflush(1); $addr = $local->accept(); $remotehost = $addr->peerhost ; $remoteport = $addr->peerport ; print "Connected from: $remotehost:$remoteport\n"; print "Command> "; while($comm = <STDIN>) { print $addr $comm; sub closeback() {exit(0)} while(sysread($addr,$buffer,1024)) { print $buffer; last; } print "Command> "; } }
Any tip? thanks.

In reply to Re^2: Socket hangs by navarro
in thread Socket hangs by navarro

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.