in reply to Win32: Redirect STDOUT to socket
close(STDOUT); before the open makes it work (but I don't know why).