What you are reading is what you sent, so what is the problem?
What you are reading is what you sent, so what is the problem?
Thanks for reply.
I know what am reading, but the method followed to read, was that correct??? because it cud able to read only one byte, rest all showing junk....
piece of code which i have posted can be referred and correct me where I went wrong......
Your code looks how many bytes are available (could be 1, could be 5000), reads that number of bytes, assumes that is some sort of valid string, and appends it to the text edit. Since the data you are sending is not printable characters this will produce rubbish in the text edit. The odd characters you show seem consistent with treating the data you say was sent as ASCII characters, which was squidge's point.
If you want to display binary data in a readable form you will have to convert it somehow. Hexadecimal is often chosen for this purpose.
If you need all 6 bytes to be present before you do something with the packet then you need to allow for all 6 bytes to arrive one at at time, buffer them, and do something when you have a full set. You would need to do this to check your checksum.
Bookmarks