I guess I was a bit vague. Thanks for the help, I learned a lot from your example
What I want to do is interpret a bunch of values from a web
page put these values in an array and convert them into a home grown
packet and send this through a socket. And I want them to be a string of 1s and 0s.
What I'm having a hard time with Perl (being a newbie) is
that I'm used to declaring unsigned 8 bit ints, 16 bit ints, etc.
The format I want to send as a packet are as so:
B: An 8 bit signed integer
Mgmt: 8 bit signed integer
ClassV: 8 bit signed integer
R: this is one bit long
Method: this is 7 bits long (int)
Status: 16 bits signed integer
ClassSpec: 16 signed int
TransID: 64 bit signed int
Rez: 16 bits signed int
AttMod: 32 bit signed int
and the Data: is 1856 bits long, can be anything.
So if I did a tcp dump, the way I want the packets to look like are:

0x06 0x01 0x07 0x00
0x00 0x00 0x00 0x00
0x00 0x00 0x10 0x00
0x61 0x1e 0x00 0x00
0x02 0x00 0x00 0x00
I've used the pack functions, but what I'm having difficulty is
with the one bit long R value and the 7 bit long Meth int.
and I have to throw it out in 1s and 0s. Thanks....

In reply to Re: (tye)Re: Sending an array through a socket! by flipxor
in thread Sending an array through a socket! by flipxor

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.