Update main to handle stop signal
Fix WIN32 recv/send deadline