@@ -82,24 +82,24 @@ { struct addrinfo hints, *res, *res0; char portstr[6]; if (!port) - @throw [OFInvalidPortException newWithClass: [self class]]; + @throw [OFInvalidPortException newWithClass: isa]; if (sock != INVALID_SOCKET) - @throw [OFAlreadyConnectedException newWithClass: [self class]]; + @throw [OFAlreadyConnectedException newWithClass: isa]; memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; snprintf(portstr, 6, "%d", port); if (getaddrinfo(host, portstr, &hints, &res0)) @throw [OFAddressTranslationFailedException - newWithClass: [self class] + newWithClass: isa andNode: host andService: portstr]; for (res = res0; res != NULL; res = res->ai_next) { if ((sock = socket(res->ai_family, res->ai_socktype, @@ -116,11 +116,11 @@ } freeaddrinfo(res0); if (sock == INVALID_SOCKET) - @throw [OFConnectionFailedException newWithClass: [self class] + @throw [OFConnectionFailedException newWithClass: isa andHost: host andPort: port]; return self; } @@ -131,17 +131,17 @@ { struct addrinfo hints, *res; char portstr[6]; if (!port) - @throw [OFInvalidPortException newWithClass: [self class]]; + @throw [OFInvalidPortException newWithClass: isa]; if (sock != INVALID_SOCKET) - @throw [OFAlreadyConnectedException newWithClass: [self class]]; + @throw [OFAlreadyConnectedException newWithClass: isa]; if ((sock = socket(family, SOCK_STREAM, 0)) == INVALID_SOCKET) - @throw [OFBindFailedException newWithClass: [self class] + @throw [OFBindFailedException newWithClass: isa andHost: host andPort: port andFamily: family]; memset(&hints, 0, sizeof(struct addrinfo)); @@ -150,17 +150,17 @@ snprintf(portstr, 6, "%d", port); if (getaddrinfo(host, portstr, &hints, &res)) @throw [OFAddressTranslationFailedException - newWithClass: [self class] + newWithClass: isa andNode: host andService: portstr]; if (bind(sock, res->ai_addr, res->ai_addrlen) == -1) { freeaddrinfo(res); - @throw [OFBindFailedException newWithClass: [self class] + @throw [OFBindFailedException newWithClass: isa andHost: host andPort: port andFamily: family]; } @@ -170,26 +170,26 @@ } - listenWithBackLog: (int)backlog { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: [self class]]; + @throw [OFNotConnectedException newWithClass: isa]; if (listen(sock, backlog) == -1) - @throw [OFListenFailedException newWithClass: [self class] + @throw [OFListenFailedException newWithClass: isa andBackLog: backlog]; return self; } - listen { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: [self class]]; + @throw [OFNotConnectedException newWithClass: isa]; if (listen(sock, 5) == -1) - @throw [OFListenFailedException newWithClass: [self class] + @throw [OFListenFailedException newWithClass: isa andBackLog: 5]; return self; } @@ -210,11 +210,11 @@ @throw e; } if ((s = accept(sock, addr, &addrlen)) == INVALID_SOCKET) { [newsock free]; - @throw [OFAcceptFailedException newWithClass: [self class]]; + @throw [OFAcceptFailedException newWithClass: isa]; } [newsock setSocket: s]; [newsock setSocketAddress: addr withLength: addrlen]; @@ -226,17 +226,17 @@ intoBuffer: (char*)buf { ssize_t ret; if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: [self class]]; + @throw [OFNotConnectedException newWithClass: isa]; switch ((ret = recv(sock, buf, size, 0))) { case 0: - @throw [OFNotConnectedException newWithClass: [self class]]; + @throw [OFNotConnectedException newWithClass: isa]; case -1: - @throw [OFReadFailedException newWithClass: [self class] + @throw [OFReadFailedException newWithClass: isa andSize: size]; } /* This is safe, as we already checked < 1 */ return ret; @@ -246,24 +246,24 @@ fromBuffer: (const char*)buf { ssize_t ret; if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: [self class]]; + @throw [OFNotConnectedException newWithClass: isa]; if ((ret = send(sock, buf, size, 0)) == -1) - @throw [OFWriteFailedException newWithClass: [self class] + @throw [OFWriteFailedException newWithClass: isa andSize: size]; /* This is safe, as we already checked for -1 */ return ret; } - (size_t)writeCString: (const char*)str { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: [self class]]; + @throw [OFNotConnectedException newWithClass: isa]; return [self writeNBytes: strlen(str) fromBuffer: str]; } @@ -271,24 +271,24 @@ { #ifndef _WIN32 int flags; if ((flags = fcntl(sock, F_GETFL)) == -1) - @throw [OFSetOptionFailedException newWithClass: [self class]]; + @throw [OFSetOptionFailedException newWithClass: isa]; if (enable) flags &= ~O_NONBLOCK; else flags |= O_NONBLOCK; if (fcntl(sock, F_SETFL, flags) == -1) - @throw [OFSetOptionFailedException newWithClass: [self class]]; + @throw [OFSetOptionFailedException newWithClass: isa]; #else u_long v = enable; if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) - @throw [OFSetOptionFailedException newWithClass: [self class]]; + @throw [OFSetOptionFailedException newWithClass: isa]; #endif return self; } @@ -295,19 +295,19 @@ - enableKeepAlives: (BOOL)enable { int v = enable; if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&v, sizeof(v))) - @throw [OFSetOptionFailedException newWithClass: [self class]]; + @throw [OFSetOptionFailedException newWithClass: isa]; return self; } - close { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: [self class]]; + @throw [OFNotConnectedException newWithClass: isa]; sock = INVALID_SOCKET; if (saddr != NULL) [self freeMem: saddr];