I have a PC with 16 RS485 serial ports attached (using 2 MOXA PCI to serial port cards).
I need to download the contents of a file (with binary data) to the devices attached to all 16 serial ports simultaneously.
I've created and launched 16 BackgroundWorkers to manage the download for each port. Each BackgroundWorker runs a method that opens a specified COM port. I use a timer with each serial port to manage reception timeout handling. I use the StopWatch class to generate dealys where required. Each BackgroundWorker also opens a FileStream with reach only access and fileshare settings on the one file to be used for downloading to all 16 ports.
There are some bizarre things happening here! The timer used with the SerialPorts doesn't appear to operate, received data is not generating received data events and there are spontaneous closures of some of the Filestreams!
Is my approach to managing multiple downloads a valid one to use? Can anyone suggest either why I'm seeing the problems described and how to solve them, or a better method to performing the simultaneous download to multiple ports?
I have had to use as many as 8 before each had the next sequencial com number, Seems like they started at 5 on the digi board we used but it has been a long time so memory is foggy now. In my case the system was monitoring 8 phone lines for incoming calls to receive sales orders from people in the field.