44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#import "OFSetOptionFailedException.h"
#import "OFWriteFailedException.h"
#import "socket.h"
#import "socket_helpers.h"
@implementation OFUDPSocket
+ (void)initialize
{
if (self != [OFUDPSocket class])
return;
if (!of_socket_init())
@throw [OFInitializationFailedException
|
>
>
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#import "OFSetOptionFailedException.h"
#import "OFWriteFailedException.h"
#import "socket.h"
#import "socket_helpers.h"
@implementation OFUDPSocket
@synthesize delegate = _delegate;
+ (void)initialize
{
if (self != [OFUDPSocket class])
return;
if (!of_socket_init())
@throw [OFInitializationFailedException
|
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
}
return ret;
}
- (void)asyncReceiveIntoBuffer: (void *)buffer
length: (size_t)length
target: (id)target
selector: (SEL)selector
context: (id)context
{
[self asyncReceiveIntoBuffer: buffer
length: length
runLoopMode: of_run_loop_mode_default
target: target
selector: selector
context: context];
}
- (void)asyncReceiveIntoBuffer: (void *)buffer
length: (size_t)length
runLoopMode: (of_run_loop_mode_t)runLoopMode
target: (id)target
selector: (SEL)selector
context: (id)context
{
[OFRunLoop of_addAsyncReceiveForUDPSocket: self
buffer: buffer
length: length
mode: runLoopMode
target: target
selector: selector
context: context];
}
#ifdef OF_HAVE_BLOCKS
- (void)asyncReceiveIntoBuffer: (void *)buffer
length: (size_t)length
block: (of_udp_socket_async_receive_block_t)block
{
|
<
<
<
|
<
<
<
<
<
<
<
|
<
|
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
}
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
length: (size_t)length
runLoopMode: (of_run_loop_mode_t)runLoopMode
{
[OFRunLoop of_addAsyncReceiveForUDPSocket: self
buffer: buffer
length: length
mode: runLoopMode
delegate: _delegate];
}
#ifdef OF_HAVE_BLOCKS
- (void)asyncReceiveIntoBuffer: (void *)buffer
length: (size_t)length
block: (of_udp_socket_async_receive_block_t)block
{
|
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
|
bytesWritten: bytesWritten
errNo: 0];
}
- (void)asyncSendBuffer: (const void *)buffer
length: (size_t)length
receiver: (of_socket_address_t)receiver
target: (id)target
selector: (SEL)selector
context: (id)context
{
[self asyncSendBuffer: buffer
length: length
receiver: receiver
runLoopMode: of_run_loop_mode_default
target: target
selector: selector
context: context];
}
- (void)asyncSendBuffer: (const void *)buffer
length: (size_t)length
receiver: (of_socket_address_t)receiver
runLoopMode: (of_run_loop_mode_t)runLoopMode
target: (id)target
selector: (SEL)selector
context: (id)context
{
[OFRunLoop of_addAsyncSendForUDPSocket: self
buffer: buffer
length: length
receiver: receiver
mode: runLoopMode
target: target
selector: selector
context: context];
}
#ifdef OF_HAVE_BLOCKS
- (void)asyncSendBuffer: (const void *)buffer
length: (size_t)length
receiver: (of_socket_address_t)receiver
block: (of_udp_socket_async_send_block_t)block
|
<
<
<
|
<
<
<
<
<
<
<
|
<
|
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
|
bytesWritten: bytesWritten
errNo: 0];
}
- (void)asyncSendBuffer: (const void *)buffer
length: (size_t)length
receiver: (of_socket_address_t)receiver
{
[self asyncSendBuffer: buffer
length: length
receiver: receiver
runLoopMode: of_run_loop_mode_default];
}
- (void)asyncSendBuffer: (const void *)buffer
length: (size_t)length
receiver: (of_socket_address_t)receiver
runLoopMode: (of_run_loop_mode_t)runLoopMode
{
[OFRunLoop of_addAsyncSendForUDPSocket: self
buffer: buffer
length: length
receiver: receiver
mode: runLoopMode
delegate: _delegate];
}
#ifdef OF_HAVE_BLOCKS
- (void)asyncSendBuffer: (const void *)buffer
length: (size_t)length
receiver: (of_socket_address_t)receiver
block: (of_udp_socket_async_send_block_t)block
|