one ProXR with four PC's

I have a single ZADR820ProXR_ETHER board connected to four Win7 PC’s.
Each PC runs a copy of a C# program (which I have source code for).
Each program controls a distinct subset of the relays on the ProXR.
Each program opens a virtual com port (Digi RealPort), sends a command
to the ProXr (as tcp/ip) and closes the virtual com port.
Normally this works, but occasionally two of the PC’s try to access
the ProXR at the same time and both programs fail, throwing
System.IO.IOException: A device attached to the system is not functioning.
Is this to be expected or am I doing something wrong?

As a work around, I have “time sliced” the four programs such that
the first only talks to the ProXR during seconds 0-12 of each minute,
the second talks during seconds 15-27, the third 30-42 and the fourth
45-57. This works at the cost of slower execution.

Can you suggest a better way?

I would try and get rid of the virtual serial port if possible and move to raw TCP. It’ll be faster to connect and disconnect so you should run into the error less often.

You can also start a thread that will be responsible for opening the connection, sending the command, receiving the response, piping it back to the main thread, and closing the connection. This would allow you to build in a try try/catch (while: time.started > time.started-1) to attempt to connect without slowing down your main thread.

Another method would be to have one main computer that opens TCP socket listeners for each other computer that wants to send data. Those listeners load the commands into a buffer that it sends out over the virtual serial into the device.

The TCP socket listeners should still be compatible with network based virtual serial port drivers on the other computers that are not the ‘main’, but I rarely use them so this is theoretical.