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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/*!
* @brief A block which is called when the socket connected.
*
* @param socket The socket which connected
* @param exception An exception which occurred while connecting the socket or
* `nil` on success
*/
typedef void (^of_tcp_socket_async_connect_block_t)(
OF_KINDOF(OFTCPSocket *) socket, id _Nullable exception);
/*!
* @brief A block which is called when the socket accepted a connection.
*
* @param socket The socket which accepted the connection
* @param acceptedSocket The socket which has been accepted
* @param exception An exception which occurred while accepting the socket or
* `nil` on success
* @return A bool whether the same block should be used for the next incoming
* connection
*/
typedef bool (^of_tcp_socket_async_accept_block_t)(
OF_KINDOF(OFTCPSocket *) socket, OF_KINDOF(OFTCPSocket *) acceptedSocket,
id _Nullable exception);
#endif
/*!
* @protocol OFTCPSocketDelegate OFTCPSocket.h ObjFW/OFTCPSocket.h
*
* A delegate for OFTCPSocket.
*/
@protocol OFTCPSocketDelegate <OFStreamDelegate>
@optional
/*!
* @brief A method which is called when a socket connected.
*
* @param socket The socket which connected
* @param host The host connected to
* @param port The port on the host connected to
* @param exception An exception that occurred while connecting, or nil on
* success
*/
- (void)socket: (OF_KINDOF(OFTCPSocket *))socket
didConnectToHost: (OFString *)host
port: (uint16_t)port
exception: (nullable id)exception;
/*!
* @brief A method which is called when a socket accepted a connection.
*
* @param socket The socket which accepted the connection
* @param acceptedSocket The socket which has been accepted
* @param exception An exception that occurred while accepting, or nil on
* success
* @return A bool whether to accept the next incoming connection
*/
- (bool)socket: (OF_KINDOF(OFTCPSocket *))socket
didAcceptSocket: (OF_KINDOF(OFTCPSocket *))acceptedSocket
exception: (nullable id)exception;
@end
/*!
* @class OFTCPSocket OFTCPSocket.h ObjFW/OFTCPSocket.h
*
* @brief A class which provides methods to create and use TCP sockets.
|
|
|
|
<
|
|
|
|
|
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*!
* @brief A block which is called when the socket connected.
*
* @param socket The socket which connected
* @param exception An exception which occurred while connecting the socket or
* `nil` on success
*/
typedef void (^of_tcp_socket_async_connect_block_t)(OFTCPSocket *socket,
id _Nullable exception);
/*!
* @brief A block which is called when the socket accepted a connection.
*
* @param socket The socket which accepted the connection
* @param acceptedSocket The socket which has been accepted
* @param exception An exception which occurred while accepting the socket or
* `nil` on success
* @return A bool whether the same block should be used for the next incoming
* connection
*/
typedef bool (^of_tcp_socket_async_accept_block_t)(OFTCPSocket *socket,
OFTCPSocket *acceptedSocket, id _Nullable exception);
#endif
/*!
* @protocol OFTCPSocketDelegate OFTCPSocket.h ObjFW/OFTCPSocket.h
*
* A delegate for OFTCPSocket.
*/
@protocol OFTCPSocketDelegate <OFStreamDelegate>
@optional
/*!
* @brief A method which is called when a socket connected.
*
* @param socket The socket which connected
* @param host The host connected to
* @param port The port on the host connected to
* @param exception An exception that occurred while connecting, or nil on
* success
*/
- (void)socket: (OFTCPSocket *)socket
didConnectToHost: (OFString *)host
port: (uint16_t)port
exception: (nullable id)exception;
/*!
* @brief A method which is called when a socket accepted a connection.
*
* @param socket The socket which accepted the connection
* @param acceptedSocket The socket which has been accepted
* @param exception An exception that occurred while accepting, or nil on
* success
* @return A bool whether to accept the next incoming connection
*/
- (bool)socket: (OFTCPSocket *)socket
didAcceptSocket: (OFTCPSocket *)acceptedSocket
exception: (nullable id)exception;
@end
/*!
* @class OFTCPSocket OFTCPSocket.h ObjFW/OFTCPSocket.h
*
* @brief A class which provides methods to create and use TCP sockets.
|