Defer deletion of socket and add more debug logging
Windows: Fix console part of application

Create process and redirect stdin, stdout and stderr in new thread.