mawinkle 6 năm trước cách đây
mục cha
commit
9aa5183684
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      socketio_posix.cpp

+ 3 - 3
socketio_posix.cpp

@@ -90,9 +90,9 @@ std::vector<char> cppsocket::receive(){
 	while(true){
 		std::fill(buffer.begin(), buffer.end(), (char)0);
 		ssize_t val = read(sock, buffer.data(), buffersize + 1);
-		if(val == 0)throw socket_exception("Connection reset by peer");
-		if(val == -1){
-			throw socket_exception(std::string("Reading error: ") + strerror(errno));
+		//if(val == 0)throw socket_exception("Connection reset by peer");
+		if(val <= 0){
+			throw socket_exception(strerror(errno));
 		}
 		std::cout << val << ", ";
 		stor.insert(stor.end(), buffer.begin(), buffer.begin() + std::min(val, (ssize_t)buffersize));