Support for either serial port or socket connection