This patch add raw tcp connection ability on bhyve and has been tested on my own machine.
I don't handle disconnection currently because there is no good way to detect this without largely changing the code right now.
An example about this is as following:
bhyve -c 2 -m 4G -w -H \ -s 0,hostbridge \ -s 1,virtio-blk,./FreeBSD-14.0-STABLE-amd64-20240118-cef433d3fb38-266364.raw \ -s 30,xhci,tablet \ -s 31,lpc -l com1,tcp=127.0.0.1:8085 \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \ uefivm
Then we can use nc by:
netcat 127.0.0.1 8085