Search code examples
.net.net-3.5serial-communication

Should I keep a SerialPort connection open?


I am working with serial communication and I'm wondering whether I should keep the SerialPort open or not?

I'm creating a queue of commands and only one will be running at a time. Should I create a SerialPort and open/close it in each command, or should I have another class which holds the port open and is called from the commands? Or does it really matter?


Solution

  • Keep it open. No point to have the overhead of opening and closing it.