1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019, 2020
* Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#include <assert.h>
#include <errno.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
|
<
<
|
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*
* Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#ifndef _XOPEN_SOURCE_EXTENDED
# define _XOPEN_SOURCE_EXTENDED
#endif
#define _HPUX_ALT_XOPEN_SOCKET_API
#include <assert.h>
#include <errno.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
_canBlock = canBlock;
#else
OF_UNRECOGNIZED_SELECTOR
#endif
}
- (size_t)receiveIntoBuffer: (void *)buffer
length: (size_t)length
{
ssize_t ret;
if (_socket == INVALID_SOCKET)
@throw [OFNotOpenException exceptionWithObject: self];
#ifndef OF_WINDOWS
|
|
<
|
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
_canBlock = canBlock;
#else
OF_UNRECOGNIZED_SELECTOR
#endif
}
- (size_t)receiveIntoBuffer: (void *)buffer length: (size_t)length
{
ssize_t ret;
if (_socket == INVALID_SOCKET)
@throw [OFNotOpenException exceptionWithObject: self];
#ifndef OF_WINDOWS
|
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
requestedLength: length
errNo: of_socket_errno()];
#endif
return ret;
}
- (void)asyncReceiveIntoBuffer: (void *)buffer
length: (size_t)length
{
[self asyncReceiveIntoBuffer: buffer
length: length
runLoopMode: of_run_loop_mode_default];
}
- (void)asyncReceiveIntoBuffer: (void *)buffer
|
|
<
|
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
requestedLength: length
errNo: of_socket_errno()];
#endif
return ret;
}
- (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length
{
[self asyncReceiveIntoBuffer: buffer
length: length
runLoopMode: of_run_loop_mode_default];
}
- (void)asyncReceiveIntoBuffer: (void *)buffer
|
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
length: length
mode: runLoopMode
block: block
delegate: nil];
}
#endif
- (void)sendBuffer: (const void *)buffer
length: (size_t)length
{
if (_socket == INVALID_SOCKET)
@throw [OFNotOpenException exceptionWithObject: self];
#ifndef OF_WINDOWS
ssize_t bytesWritten;
|
|
<
|
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
length: length
mode: runLoopMode
block: block
delegate: nil];
}
#endif
- (void)sendBuffer: (const void *)buffer length: (size_t)length
{
if (_socket == INVALID_SOCKET)
@throw [OFNotOpenException exceptionWithObject: self];
#ifndef OF_WINDOWS
ssize_t bytesWritten;
|
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
requestedLength: length
bytesWritten: bytesWritten
errNo: 0];
}
- (void)asyncSendData: (OFData *)data
{
[self asyncSendData: data
runLoopMode: of_run_loop_mode_default];
}
- (void)asyncSendData: (OFData *)data
runLoopMode: (of_run_loop_mode_t)runLoopMode
{
[OFRunLoop of_addAsyncSendForSequencedPacketSocket: self
data: data
|
|
<
|
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
requestedLength: length
bytesWritten: bytesWritten
errNo: 0];
}
- (void)asyncSendData: (OFData *)data
{
[self asyncSendData: data runLoopMode: of_run_loop_mode_default];
}
- (void)asyncSendData: (OFData *)data
runLoopMode: (of_run_loop_mode_t)runLoopMode
{
[OFRunLoop of_addAsyncSendForSequencedPacketSocket: self
data: data
|