@@ -98,15 +98,13 @@ isAtEndOfStream = YES; return ret; } -- (size_t)_writeNBytes: (size_t)length - fromBuffer: (const void*)buffer +- (void)_writeNBytes: (size_t)length + fromBuffer: (const void*)buffer { - ssize_t ret; - if (sock == INVALID_SOCKET) @throw [OFNotConnectedException newWithClass: isa socket: self]; if (isAtEndOfStream) { @@ -122,16 +120,14 @@ #endif @throw e; } - if ((ret = send(sock, buffer, length, 0)) == -1) + if (send(sock, buffer, length, 0) < length) @throw [OFWriteFailedException newWithClass: isa stream: self requestedLength: length]; - - return ret; } #ifdef _WIN32 - (void)setBlocking: (BOOL)enable {