TCP transmissions ALWAYS consist of bytes of data. A Byte is a number in the range of 0 to 255.
We humans put "representations" on those bytes to be able to display them on paper and to talk about them. That does not change the fact that they are always bytes (8-bit chunks) of data. Remember I am discussing this in the context of communications not floating point arithmetic!
The most common representations we use are decimal integers, Hexadecimal integers and ASCII Characters. There are others also.
Decimal integers are the easiest, because we are so familiar with them.
To represent a byte as Hexadecimal integers we need to break the byte into two 4 bit quantities, sometimes called nybbles, and for each nibble show its hexadecimal digit. The Hex digits are 0-9, a, b, c, d, e, f; sometimes also expressed as 0-9, A, B, C, D, E, F.
When we represent the bytes as ASCII we are using the ASCII collating sequence of characters. A collating sequence ascribes an ordering to the set of graphic characters (symbols) by associating each valid symbol with an integer value, commonly referred to as its collating sequence index. Standard ASCII only has single symbol representations for the bytes whose values are 32 to 127 (decimal). There are no single character representations for the bytes with values less than 32, nor for those above 127. There are somewhat agreed to multicharacter representatiions for those bytes below index 32 in Ascii, generally referred to as the "Control Characters". For example the carriage return, which has an index of 13, is generally represented textually as CR. When I represent it I show it as "(CR)" without the quote marks.
Now we get into confusions. Looking at a printed sequence of bytes 00 10 45 67 we should always assume them to be decimal values as shown. We need a convention to state that the sequence is not decimal or is a mixture of decimal and hexadecimal reprentations. The widely agreed to notation is \xYY which means interpret YY as hexadecimal symbols not decimal symbols. This means that we always view 45 as decimal 45 but view \x45 as decimal value 69. Conversely if we have the byte with decimal value of 69 we can show it as 69 or \x45 on paper, or even the Ascii symbol "E" (without the quotes).
As further confusion the sequence 00 10 45 67 might actually be the ascii reprentation. If this were the case then the internal byte sequence is
48 48 32 49 48 32 52 53 32 54 55
or as integers in hexadecimal representation
\x30 \x30 \x20 \x31 \x30 \x20 \x34 \x35 \x20 \x36 \x37
Just keep in mind that in memory IT ALWAYS IS A SEQUENCE OF BYTES CONTAINING INTEGERS IN THE DECIMAL RANGE 0 to 255. There is no explicit memory typing in a non tagged architecture. The contents of a memory cell or region (sequence of cells) only has meaning by the operations applied to it, intrinsicly it always is numbers or sequences of numbers.
Last edited by Barry Gordon on December 21, 2010 20:09.