17 #import "OFStreamSocket.h"
21 OF_ASSUME_NONNULL_BEGIN
64 struct sockaddr *_address;
65 socklen_t _addressLength;
69 bool _keepAliveEnabled, _TCPNoDelayEnabled;
73 #ifdef OF_HAVE_PROPERTIES
74 @property (readonly, getter=isListening)
bool listening;
75 @property OF_NULLABLE_PROPERTY (copy)
OFString *SOCKS5Host;
76 @property uint16_t SOCKS5Port;
77 @property (getter=isKeepAliveEnabled)
bool keepAliveEnabled;
78 @property (getter=isTCPNoDelayEnabled)
bool TCPNoDelayEnabled;
87 + (void)setSOCKS5Host: (nullable
OFString*)SOCKS5Host;
101 + (void)setSOCKS5Port: (uint16_t)SOCKS5Port;
108 + (uint16_t)SOCKS5Port;
115 - (void)setSOCKS5Host: (nullable
OFString*)host;
131 - (void)setSOCKS5Port: (uint16_t)port;
138 - (uint16_t)SOCKS5Port;
146 - (void)connectToHost: (
OFString*)host
147 port: (uint16_t)port;
149 #ifdef OF_HAVE_THREADS
160 - (void)asyncConnectToHost: (
OFString*)host
163 selector: (
SEL)selector;
165 # ifdef OF_HAVE_BLOCKS
173 - (void)asyncConnectToHost: (
OFString*)host
188 - (uint16_t)bindToHost: (
OFString*)host
189 port: (uint16_t)port;
196 - (void)listenWithBackLog: (
int)backLog;
208 - (instancetype)accept;
221 - (void)asyncAcceptWithTarget: (
id)target
222 selector: (
SEL)selector;
224 #ifdef OF_HAVE_BLOCKS
242 - (nullable
OFString*)remoteAddress;
256 - (void)setKeepAliveEnabled: (
bool)enabled;
263 - (bool)isKeepAliveEnabled;
270 - (void)setTCPNoDelayEnabled: (
bool)enabled;
277 - (bool)isTCPNoDelayEnabled;
283 extern Class OF_NULLABLE of_tls_socket_class;
288 OF_ASSUME_NONNULL_END
A class for handling strings.
Definition: OFString.h:91
bool(^ of_tcp_socket_async_accept_block_t)(OFTCPSocket *socket, OFTCPSocket *acceptedSocket, OFException *OF_NULLABLE exception)
A block which is called when the socket accepted a connection.
Definition: OFTCPSocket.h:49
The base class for all exceptions in ObjFW.
Definition: OFException.h:144
void(^ of_tcp_socket_async_connect_block_t)(OFTCPSocket *socket, OFException *OF_NULLABLE exception)
A block which is called when the socket connected.
Definition: OFTCPSocket.h:36
A class which provides functions to create and use TCP sockets.
Definition: OFTCPSocket.h:61
A class which provides functions to create and use stream sockets.
Definition: OFStreamSocket.h:28