TCP/Serial Transfer example - Adding Characters

Hi,

I’ve noticed that when I send a 0x0A character to the digi device via a TCP socket connection, it for some reason sends the following out of the serial port “0x0D 0x0A”. It adds a carriage return whenever a new line character is received.

I need to send raw binary data through the Digi module and corrupts my data packets. How could I disable this functionality?

Thanks a lot!

Hello

Start by calling tcgetattr() (Described in the API reference guide). It fill sin a pointer to a termios_p structure. One of the fields therein is entitled c_oflag. One of the c_oflag bits is ONLCR. See if this is set on by default. On (I believe means “Newlines in data stream become CR-NL”). Try anding the bit mask such that the ONLCR is set off (0). This use tcsetattr() (also described in the API reference guide) to set the serial port such that ONLCR is shut off. That might help.

1 Like

Thanks! this has cleared the problem. This feature is ON by default in the TCP-Serial tunnel demo applicaiton