I've got what I think should work, but something is causing server to hang up when a socket is kept alive to receive more data.