226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
-
+
+
+
+
+
|
intoBuffer: (uint8_t*)buf
{
ssize_t ret;
if (sock == INVALID_SOCKET)
@throw [OFNotConnectedException newWithClass: [self class]];
if ((ret = recv(sock, (char*)buf, size, 0)) < 1)
switch ((ret = recv(sock, (char*)buf, size, 0))) {
case 0:
@throw [OFNotConnectedException newWithClass: [self class]];
case -1:
@throw [OFReadFailedException newWithClass: [self class]
andSize: size];
}
/* This is safe, as we already checked < 1 */
return ret;
}
- (size_t)writeNBytes: (size_t)size
fromBuffer: (const uint8_t*)buf
|