Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

$cmd = 'qx(ls)'
The server does not eval this string, so you'll have to remove the "qx()" from the string. When you do this, server will receive the string "ls" and will run system("ls") which is probably what you want.

print "$destination ,$cmd \n";
You don't actually send anything to the server. Try sending your string or use IO::Socket::INET and print $socket $your_data.

By the way, you may want to set the server-site socket to the non-blocking mode (for example), because right now you are trying to receive MAX_RECV_LEN (=65535) bytes while the client sends only two ("ls"). I'm not sure, but recv will probably block until it receives LENGTH data or the socket is closed (which is unlikely with UDP).

And another thing: shouldn't it be better to run some already existing remote shell server? For example, using ssh you'll be able to encrypt your connection, protect your password and restrict the shell access, not leaving it open to any person with a netcat or similar program.

Did I forget to mention that ssh is scriptable via Perl?

Sorry if my advice was wrong.

In reply to Re: socket programming by aitap
in thread socket programming by bluntboy31

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (4)
    As of 2018-08-16 09:55 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Asked to put a square peg in a round hole, I would:









      Results (167 votes). Check out past polls.

      Notices?