Lots of fixes, everything works and is talking to a dummy socket server
Next step is to get it talking to the C code.