@@ -53,11 +53,12 @@ if (self != [OFStreamSocket class]) return; if (WSAStartup(MAKEWORD(2, 0), &wsa)) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } #endif + socket { @@ -73,19 +74,19 @@ intoBuffer: (void*)buffer { ssize_t ret; if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: isa - socket: self]; + @throw [OFNotConnectedException exceptionWithClass: isa + socket: self]; if (atEndOfStream) { OFReadFailedException *e; - e = [OFReadFailedException newWithClass: isa - stream: self - requestedLength: length]; + e = [OFReadFailedException exceptionWithClass: isa + stream: self + requestedLength: length]; #ifndef _WIN32 e->errNo = ENOTCONN; #else e->errNo = WSAENOTCONN; #endif @@ -92,13 +93,13 @@ @throw e; } if ((ret = recv(sock, buffer, length, 0)) < 0) - @throw [OFReadFailedException newWithClass: isa - stream: self - requestedLength: length]; + @throw [OFReadFailedException exceptionWithClass: isa + stream: self + requestedLength: length]; if (ret == 0) atEndOfStream = YES; return ret; @@ -106,19 +107,19 @@ - (void)_writeNBytes: (size_t)length fromBuffer: (const void*)buffer { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: isa - socket: self]; + @throw [OFNotConnectedException exceptionWithClass: isa + socket: self]; if (atEndOfStream) { OFWriteFailedException *e; - e = [OFWriteFailedException newWithClass: isa - stream: self - requestedLength: length]; + e = [OFWriteFailedException exceptionWithClass: isa + stream: self + requestedLength: length]; #ifndef _WIN32 e->errNo = ENOTCONN; #else e->errNo = WSAENOTCONN; #endif @@ -125,24 +126,24 @@ @throw e; } if (send(sock, buffer, length, 0) < length) - @throw [OFWriteFailedException newWithClass: isa - stream: self - requestedLength: length]; + @throw [OFWriteFailedException exceptionWithClass: isa + stream: self + requestedLength: length]; } #ifdef _WIN32 - (void)setBlocking: (BOOL)enable { u_long v = enable; blocking = enable; if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) - @throw [OFSetOptionFailedException newWithClass: isa - stream: self]; + @throw [OFSetOptionFailedException exceptionWithClass: isa + stream: self]; } #endif - (int)fileDescriptor { @@ -150,12 +151,12 @@ } - (void)close { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: isa - socket: self]; + @throw [OFNotConnectedException exceptionWithClass: isa + socket: self]; close(sock); sock = INVALID_SOCKET; atEndOfStream = NO;