From e52d398f9dfa09cfa225224ae45ccb56b3e471c8 Mon Sep 17 00:00:00 2001 From: Souryo Date: Mon, 7 Jul 2014 23:38:29 -0400 Subject: [PATCH] Close socket when connection was closed by peer (recv returns 0) --- Utilities/Socket.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Utilities/Socket.h b/Utilities/Socket.h index bc574668..2479febe 100644 --- a/Utilities/Socket.h +++ b/Utilities/Socket.h @@ -210,6 +210,12 @@ public: SetConnectionErrorFlag(); } + if(returnVal == 0) { + //Socket closed + std::cout << "Socket closed by peer." << std::endl; + Close(); + } + return returnVal; } };