Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

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

Thanks for the replies, but how is it useful that using a number as string? Because I'm not sure about the results yet. The thing is, I'm trying to learn a new protocol that I should use it to give orders to a machine remotely. Also I need to calculate a variable so I need numeric values instead of strings.

#!/usr/bin/perl use warnings; use strict; use IO::Socket; my ($SM,@ADRDSTN,@ADRSRC,$MID,$MDLH,$MDLL,$SUBMID,@CHreq,@Pity,@Flags, +@Timeout,@Level,$NumOfSrcEl,@SrcEl,$NumOfDstnEl,@DstnEl,$Rsvd,@messag +e,$CHECKSUM,$EM); $SM = 0xfe; @ADRDSTN= (0x00, 0x09, 0x01, 0x00); @ADRSRC= (0x00, 0x08, 0x01, 0x00); $MID= 0x01; $MDLH= 0x00; $MDLL= 0x18; $SUBMID= 0x00; @CHreq= (0x00, 0x61); @Pity= (0xFF, 0x05); @Flags= (0x00, 0x20); @Timeout= (0x00, 0x00); @Level= (0x00, 0x00); $NumOfSrcEl= 0x01; @SrcEl= (0x00, 0xFF, 0x00, 0x84, 0x10, 0x00); $NumOfDstnEl= 0x01; @DstnEl= (0x08, 0x10, 0x00, 0x01, 0x01); $Rsvd= 0x00; @message= (@ADRDSTN,@ADRSRC,$MID,$MDLH,$MDLL,$SUBMID,@CHreq,@Pity,@Fla +gs,@Timeout,@Level,$NumOfSrcEl,@SrcEl,$NumOfDstnEl,@DstnEl,$Rsvd); $EM= 0xFD; my $count=0; $count += $message[$_] for 0..@message-1 ; $count = 256 - ($count % 256); $CHECKSUM=$count; my @VPAP=($SM,@message,$CHECKSUM,$EM); my $sock = new IO::Socket::INET ( PeerAddr => 'localhost', PeerPort => '7070', Proto => 'tcp', ); die "Could not create socket: $!\n" unless $sock; print $sock @VPAP; close($sock);

In reply to Re: I need Hex conversion, not! by Anonymous Monk
in thread I need Hex conversion, not! by Anonymous Monk

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?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (10)
    As of 2018-03-20 16:50 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (255 votes). Check out past polls.