Got project to compile. Can now do remote invocations indefinitely.

Turns out you should only close the stream, not the socket.