<?xml version="1.0" encoding="windows-1252"?>
<node id="1012033" title="Re: I need Hex conversion, not!" created="2013-01-07 08:44:46" updated="2013-01-07 08:44:46">
<type id="11">
note</type>
<author id="961">
Anonymous Monk</author>
<data>
<field name="doctext">
&lt;p&gt;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. &lt;/p&gt;

&lt;code&gt;
#!/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,@message,$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,@Flags,@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 =&gt; 'localhost',
                                        PeerPort =&gt; '7070',
                                        Proto =&gt; 'tcp',
                                );
die "Could not create socket: $!\n" unless $sock;

print $sock @VPAP; 
close($sock);


&lt;/code&gt;</field>
<field name="root_node">
1012021</field>
<field name="parent_node">
1012021</field>
<field name="reputation">
2</field>
</data>
</node>
