Now works with either serialport or socket over serial connection