AnsweredAssumed Answered

Character 10

Question asked by VRFuser on Oct 21, 1997
Hi everybody,

We are trying to send a message by means of a socket. This message is built
as follows:


Length              2 bytes           n bytes
Type                INTx16            n-2 characters
Variable name    message_Length      message_body.

That is, it is composed by the message_length followed by the message_body.
Message_length is the message length in bytes of all the message (n+2
bytes), and it is a INTx16. The message_body includes the message itself
with data to be used. It is according to requirements.

The problem appears when we try to link message_length to message_body to
send whole the message at the same time.

If it is performed as follows:

    +--------------------------------------+
    |  to/From Socket                      |
    +---------+----------------------------+
    |         | Connect port          5001 |
    |         | Host name   xxx.xxx.xxx.xxx|
    | length  | Timeout                  1 |
    |         +----------------------------+
    |         | WRITE BINARY length INT16  |
    |  body   | WRITE TEXT body STR        |
    |         |                            |
    +---------+----------------------------+

The problem is that although first transaction is performed without "END OF
LINE", the message is sent in two times: first the integer and second the body.
The requirements are only in one line.

Due to that, we try to convert all in character format to get a string. It
means to translate the INTx16 value in the corresponding two characters, one
for the first byte and other for the second. In order to do that, we have
used the "intToChar" object function.
Then, we convert the first and second bytes of the INTx16 and we concatenate
them with the message body. In this case we could use the socket as follows:


    +--------------------------------------+
    |  to/From Socket                      |
    +---------+----------------------------+
    |         | Connect port          5001 |
    |         | Host name   xxx.xxx.xxx.xxx|
    |         | Timeout                  1 |
    |         +----------------------------+
    |message  | WRITE BYNARY message STR   |
    |         |                            |
    +---------+----------------------------+


The problem appears when we try to convert string corresponding to decimal
number 0 and 10. Specially character related to number 10 (
or <LF>) is
impossible to obtain and to send. The same can be simulated if "To String"
object is used.

Any ideas about it.

Thanks in advance,
______________________________________________________

Juan Carlos Martin
E-mail     : jcmar@mdr.indra-espacio.es
Phone      : 34-1-3963995
Fax     : 34-1-3963912
Earth Stations Department
INDRA ESPACIO / MADRID /SPAIN

Outcomes