Differences From Artifact [047e480ca4]:
- File
src/OFDatagramSocket.m
— part of check-in
[e5b2ee56ff]
at
2020-04-26 16:21:38
on branch trunk
— Add OFSequencedPacketSocket
This is intended for SCTP and SPX. (user: js, size: 8103) [annotate] [blame] [check-ins using]
To Artifact [08aed9e1e3]:
- File src/OFDatagramSocket.m — part of check-in [310fd74f89] at 2020-05-03 12:14:25 on branch trunk — OFDatagramSocket: Add broadcastAllowed property (user: js, size: 8836) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #endif #import "OFDatagramSocket.h" #import "OFData.h" #import "OFRunLoop+Private.h" #import "OFRunLoop.h" #import "OFInitializationFailedException.h" #import "OFNotOpenException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFSetOptionFailedException.h" #import "OFWriteFailedException.h" #import "socket.h" #import "socket_helpers.h" @implementation OFDatagramSocket | > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #endif #import "OFDatagramSocket.h" #import "OFData.h" #import "OFRunLoop+Private.h" #import "OFRunLoop.h" #import "OFGetOptionFailedException.h" #import "OFInitializationFailedException.h" #import "OFNotOpenException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFSetOptionFailedException.h" #import "OFSetOptionFailedException.h" #import "OFWriteFailedException.h" #import "socket.h" #import "socket_helpers.h" @implementation OFDatagramSocket |
| ︙ | ︙ | |||
122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
errNo: of_socket_errno()];
_blocking = enable;
#else
OF_UNRECOGNIZED_SELECTOR
#endif
}
- (size_t)receiveIntoBuffer: (void *)buffer
length: (size_t)length
sender: (of_socket_address_t *)sender
{
ssize_t ret;
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
errNo: of_socket_errno()];
_blocking = enable;
#else
OF_UNRECOGNIZED_SELECTOR
#endif
}
- (void)setBroadcastAllowed: (bool)allowed
{
int v = allowed;
if (setsockopt(_socket, SOL_SOCKET, SO_BROADCAST,
(char *)&v, (socklen_t)sizeof(v)) != 0)
@throw [OFSetOptionFailedException
exceptionWithObject: self
errNo: of_socket_errno()];
#ifdef OF_WII
_broadcastAllowed = allowed;
#endif
}
- (bool)isBroadcastAllowed
{
#ifndef OF_WII
int v;
socklen_t len = sizeof(v);
if (getsockopt(_socket, SOL_SOCKET, SO_BROADCAST,
(char *)&v, &len) != 0 || len != sizeof(v))
@throw [OFGetOptionFailedException
exceptionWithObject: self
errNo: of_socket_errno()];
return v;
#else
return _broadcastAllowed;
#endif
}
- (size_t)receiveIntoBuffer: (void *)buffer
length: (size_t)length
sender: (of_socket_address_t *)sender
{
ssize_t ret;
|
| ︙ | ︙ |