Added some debug statements.
A workable C version is available. It's blocking at the moment, will thread this soon when I work out how I want the Connection to handle closing a connection.