philm philm - 6 days ago 4
C# Question

Transferring binary file over through RS232 using C#

I am looking to transfer a binary file via RS232. I need to do this to 5000 different devices (no joke). I could do them one-by-one through a terminal program but that will take a lot of time.

So, I am writing a C# program that will be able to automate the process. I am looking at using XMODEM protocol and command line parameters to start the process. I have been looking for this for a few hours now and far my results have turned up little. I tried using uCON but that takes some sort of scripting language.

I was wondering if anyone in the community here might know of a solution to transfer a file over RS232 and program it in C#. Whether it is from a protocol (XMODEM) or a program that accepts command line or some other custom solution, doesn't really matter to me.

Answer

Ok so I was able to confirm that ghielectronics.com/community/codeshare/entry/825

code was able to work. The issue was was that I did not know how long it would take the device to transfer the file. Left it on overnight and I was able to successfully transfer a binary file. Just need to rough in the code a bit more. (See my comment below my post)

This C# code snippet allows anyone to transfer a binary file over the Serial Port. This is done all in code and does not need a windows terminal. Which works fine.