41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#endif
+ socket
{
return [[[self alloc] init] autorelease];
}
- (BOOL)atEndOfStreamWithoutCache
{
return eos;
}
- (size_t)readNBytesWithoutCache: (size_t)size
intoBuffer: (char*)buf
{
ssize_t ret;
if (sock == INVALID_SOCKET || eos)
@throw [OFNotConnectedException newWithClass: isa];
if ((ret = recv(sock, buf, size, 0)) < 0)
@throw [OFReadFailedException newWithClass: isa];
if (ret == 0)
eos = YES;
return ret;
}
- (size_t)writeNBytesWithoutCache: (size_t)size
fromBuffer: (const char*)buf
{
ssize_t ret;
if (sock == INVALID_SOCKET)
@throw [OFNotConnectedException newWithClass: isa];
if ((ret = send(sock, buf, size, 0)) == -1)
|
|
|
|
|
|
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#endif
+ socket
{
return [[[self alloc] init] autorelease];
}
- (BOOL)_atEndOfStream
{
return eos;
}
- (size_t)_readNBytes: (size_t)size
intoBuffer: (char*)buf
{
ssize_t ret;
if (sock == INVALID_SOCKET || eos)
@throw [OFNotConnectedException newWithClass: isa];
if ((ret = recv(sock, buf, size, 0)) < 0)
@throw [OFReadFailedException newWithClass: isa];
if (ret == 0)
eos = YES;
return ret;
}
- (size_t)_writeNBytes: (size_t)size
fromBuffer: (const char*)buf
{
ssize_t ret;
if (sock == INVALID_SOCKET)
@throw [OFNotConnectedException newWithClass: isa];
if ((ret = send(sock, buf, size, 0)) == -1)
|