1

When I tried to send an acknowledgement its receiving (0x06) at server. public static final byte ACK[] = {0x06};

Now I wanted to send this same response after the ACK..

2303130312C30362C30382C43414E43454C205245515545535445442C32393236323031332C303

but I am not able to load like the same, I get an error of OCTAL INTEGER.

public static byte RES[] = {2303130312 (from this the error occurs)C30362C30382C43414E43454C205245515545535445442C32393236323031332C303 };

Can you pls help me how to send this data from client side to server.

while (connected) {
            String receive = TCPClient.byteArrayToHexString(tcpClient.receive(100, 1000));
            String xd = receive.substring( 0,20 );
            Log.d( "WING", xd );
            eReceiveData.setText(xd);
            Log.d( "WINGS SEND", Arrays.toString( TCPClient.StringToByteArray( "0x06" ) ) );
            tcpClient.send(ACK);
j.doe
  • 662
  • 4
  • 19
FinaHina
  • 37
  • 5
  • There is nothing huge about this data. – user207421 Apr 07 '19 at 10:03
  • this is the data i need to send "02303130312C30362C30382C43414E43454C205245515545535445442C32393236323031332C3030303030303030303939382C303030322C2C2C2C2C2C2C2C2C2C2C2C2C2C2C0352" when i am trying to send them in Bytes the Alphabets in the data are causing the error like octal integer error, int is too long, ..... @user207421 – FinaHina Apr 07 '19 at 13:24

1 Answers1

1

Look at this "Convert a string representation of a hex dump to a byte array using Java?"

You will find how to load your data as byte array.

Mir Milad Hosseiny
  • 2,769
  • 15
  • 19