Overview
Comment: | OFDatagramSocket: Add broadcastAllowed property |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
310fd74f895a9a0e5f31e02adefbc2b9 |
User & Date: | js on 2020-05-03 12:14:25 |
Other Links: | manifest | tags |
Context
2020-05-03
| ||
19:36 | Add OFSPXStreamSocket check-in: 0ded796f1a user: js tags: trunk | |
12:14 | OFDatagramSocket: Add broadcastAllowed property check-in: 310fd74f89 user: js tags: trunk | |
2020-05-02
| ||
19:13 | Update buildsys check-in: 64f22ba97e user: js tags: trunk | |
Changes
Modified src/OFDatagramSocket.h from [a18e14bea6] to [c9598f3c24].
︙ | |||
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | + + + + + + + + | * was called to create one "instance" for every thread! */ @interface OFDatagramSocket: OFObject <OFCopying, OFReadyForReadingObserving, OFReadyForWritingObserving> { of_socket_t _socket; bool _blocking; #ifdef OF_WII bool _broadcastAllowed; #endif id <OFDatagramSocketDelegate> _Nullable _delegate; OF_RESERVE_IVARS(4) } /*! * @brief Whether the socket is in blocking mode. * * By default, a socket is in blocking mode. */ @property (nonatomic, getter=isBlocking) bool blocking; /*! * @brief Whether the socket is allowed to send to broadcast addresses. */ @property (nonatomic, getter=isBroadcastAllowed) bool broadcastAllowed; /*! * @brief The delegate for asynchronous operations on the socket. * * @note The delegate is retained for as long as asynchronous operations are * still ongoing. */ @property OF_NULLABLE_PROPERTY (assign, nonatomic) |
︙ |
Modified src/OFDatagramSocket.m from [047e480ca4] to [08aed9e1e3].
︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 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 | 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; |
︙ |
Modified src/OFTCPSocket.m from [aa9ac8bab1] to [48edda05b6].
︙ | |||
947 948 949 950 951 952 953 | 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | - + | { int v; socklen_t len = sizeof(v); if (getsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException |
︙ | |||
974 975 976 977 978 979 980 | 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 | - + | { int v; socklen_t len = sizeof(v); if (getsockopt(_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException |
︙ |
Modified src/exceptions/OFGetOptionFailedException.h from [4a4969db85] to [70541d2ad1].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 | - - - + - + - + - + - + - + - + - + | * file. */ #import "OFException.h" OF_ASSUME_NONNULL_BEGIN |
Modified src/exceptions/OFGetOptionFailedException.m from [2c7cb59f5d] to [a2104983ac].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 | - - + - + - + - + - + - + - - + + | * file. */ #include "config.h" #import "OFGetOptionFailedException.h" #import "OFString.h" |