I'm developing software which controls various hardware via serial ports, TCP/IP, USB, etc. The main program usually works for hours or even days without restart. Each action of the program processed as follows:
- Open connection (port, VISA instr., TCP/IP)
- Send message/receive answer
- Close connection
The question is whether it's reasonable/safe/reliable to open and close connections each time? Or possibly it is better to open each connection just once per session at start?