Re: RS232 Redirector Program in C using Linux



Please don't quote the entire article just to add a few lines. Quote only the relevant parts.

Steffen wrote:

Confusing is that if i am sending a normal text file.. e. g. my
sourcecode-file.... this works fine... no problems.


No, I am wrong - sorry for that much posting of my side - if i am
transfering a raw file (means not only a text file), the whole file
gets corrupted... not only the beginning of the file :-(

You can do some additional analysis by saving the data that you transfer in the redirector. That way you can find out if, from the redirector's perspective, the incoming data stream is corrupted or the outgoing.

Just open a local file and, when reading from the incoming fd, save the data read to that file. If that file is corrupted and it's identical to the destination file, you know that the problem lies on the incoming path, else it's the outgoing path. Maybe you have a problem on the sending side or on the receiving side (and not in the redirector), but anyway, that will help you rule out half of the setup.

Personally I'd suspect this assumption:
/* cfmakeraw does this:
...
*/
Maybe it doesn't ... Try inserting the explicit manipulation of the termios structure and/or print out the termios structure prior to calling tcsetattr.

BTW In what way does the whole file get corrupted? Are bytes missing? Which? Are bytes added? Which? Are bytes modified? Which?

Josef
--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html

.