iOS Question Logging a byte array?

techknight

Well-Known Member
Licensed User
Longtime User
Is it possible to log a byte array into the log window without converting it?

On the Buffer() array from Astreams there is a character or something getting in there thats causing the Bytestostring to crash, but I cannot tell what.

B4X:
    Try
        RxPacket = RxPacket & BytesToString(Buffer, 0, Buffer.Length, "UTF8")
    Catch
        RxPacket = ""
        #IF DEBUG
        Log("Non string character detected in buffer, flushing.")
        #End If
        Return
    End Try

Above code works fine until something gets in the buffer that causes a "Cannot parse as string" crash which ends up in the "Catch" routine.

Of course the Try-Catch prevents my program from crashing and I eventually get the right response and everything is fine. BUT, I cannot help but wonder as to why...

any ideas?
 
Last edited:

techknight

Well-Known Member
Licensed User
Longtime User
I like hex strings. its easier for me to read, perform operations on, etc.. Plus I am not changing 5+ years worth of work.

Anyways, This answers my question. a Simple "no". I will leave the catch in there then. Seems to work as is.
 
Upvote 0

stanmiller

Active Member
Licensed User
Longtime User
I like hex strings. its easier for me to read, perform operations on, etc...

Me too. Transmit as strings if practicable for command and control. String representation is not only portable but also easy to debug through WireShark. And if you need to compact and/or hide use RLE compression and obfuscate with symmetrical XOR character-based encryption.
 
Last edited:
Upvote 0
Top