             }
         }
         catch let error as Socket.Error {
-            Log.error("Read from socket (file descriptor \(socket.socketfd)) failed. Error = \(error).")
+            if error.errorCode == Int32(Socket.SOCKET_ERR_CONNECTION_RESET) {
+                Log.debug("Read from socket (file descriptor \(socket.socketfd)) reset. Error = \(error).")
+            } else {
+                Log.error("Read from socket (file descriptor \(socket.socketfd)) failed. Error = \(error).")
+            }
             prepareToClose()
         } catch {
             Log.error("Unexpected error...")

                }
            }
            catch let error {
                Log.error("Write to socket (file descriptor \(socket.socketfd)) failed. Error = \(error).")
            }
            
            #if os(OSX) || os(iOS) || os(tvOS) || os(watchOS) || GCD_ASYNCH

            }
        }
        catch let error {
            if let error = error as? Socket.Error, error.errorCode == Int32(Socket.SOCKET_ERR_CONNECTION_RESET) {
                Log.debug("Write to socket (file descriptor \(socket.socketfd)) failed. Error = \(error).")
            } else {
                Log.error("Write to socket (file descriptor \(socket.socketfd)) failed. Error = \(error).")
            }
        }
    }
    
