ObjFW  Check-in [c4f36e3692]

Overview
Comment:OFUDPSocket: Add observing
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c4f36e36920317dbb82d05cbd26bd31d7607d54ffcdf80c3d6c5859c77d2bcc3
User & Date: js on 2014-01-29 15:59:01
Other Links: manifest | tags
Context
2014-01-30
12:26
Rename +[UDPSocket hostForAddress:port:] check-in: fb590316ba user: js tags: trunk
2014-01-29
15:59
OFUDPSocket: Add observing check-in: c4f36e3692 user: js tags: trunk
15:54
Generalize OFKernelEventObserver check-in: c694569d86 user: js tags: trunk
Changes

Modified src/OFUDPSocket.h from [3d20c31b29] to [7885c380e7].

11
12
13
14
15
16
17

18
19
20
21
22
23
24
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25







+







 * 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.
 */

#import "OFObject.h"
#import "OFKernelEventObserver.h"

#import "socket.h"

/*! @file */

/*!
 * @brief A struct which represents a host / port pair for a UDP socket.
34
35
36
37
38
39
40
41


42
43
44
45
46
47
48
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49
50







-
+
+







 * Addresses are of type @ref of_udp_socket_address_t. You can use
 * @ref resolveAddressForHost:port:address: to create an address for a host /
 * port pair and @ref hostForAddress:port: to get the host / port pair for an
 * address. If you want to compare two addresses, you can use
 * @ref of_udp_socket_address_equal and you can use
 * @ref of_udp_socket_address_hash to get a hash to use in e.g. @ref OFMapTable.
 */
@interface OFUDPSocket: OFObject
@interface OFUDPSocket: OFObject <OFReadyForReadingObserving,
    OFReadyForWritingObserving>
{
	int _socket;
}

/*!
 * @brief Returns a new, autoreleased OFUDPSocket.
 *

Modified src/OFUDPSocket.m from [72deb2c0c0] to [e5e2000892].

280
281
282
283
284
285
286










287
288
289
290
291
292
293
294
295
296
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306







+
+
+
+
+
+
+
+
+
+










		@throw [OFNotConnectedException exceptionWithSocket: self];

	if (sendto(_socket, buffer, length, 0,
	    (struct sockaddr*)&receiver->address, receiver->length) < length)
		@throw [OFWriteFailedException exceptionWithObject: self
						   requestedLength: length];
}

- (int)fileDescriptorForReading
{
	return _socket;
}

- (int)fileDescriptorForWriting
{
	return _socket;
}

- (void)close
{
	if (_socket == INVALID_SOCKET)
		@throw [OFNotConnectedException exceptionWithSocket: self];

	close(_socket);
	_socket = INVALID_SOCKET;
}
@end