YLTCPSocket Class Reference
| Inherits from | NSObject |
| Declared in | YLTCPSocket.h |
Overview
The main purpose of the YLTCPSocket is to try to open a TCP socket with a
remote host to check if a connection is possible.
Properties
Class Methods
socketWithHostname:port:
Creates a TCP socket with an endpoint’s name and port number.
+ (instancetype)socketWithHostname:(NSString *)hostname port:(SInt32)portParameters
- hostname
The hostname of the remote endpoint.
- port
The TCP port number to which the socket should connect.
Availability
1.0.0
See Also
Declared In
YLTCPSocket.hInstance Methods
connectWithCompletionHandler:
Performs an asynchronous connection to the remote endpoint and call the completion handler when the operation did finished or if the time exceeded the timeout.
- (void)connectWithCompletionHandler:(YLTCPSocketCompletionBlock)completionBlockParameters
- completionBlock
A socket completion block.
Availability
1.0.0
Discussion
The operation is performed with the
kYLTCPSocketDefaultTimeoutInSeconds timeout value.
Declared In
YLTCPSocket.hconnectWithTimeoutInterval:completionHandler:
Performs an asynchronous connection to the remote endpoint and call the completion handler when the operation did finished or if the time exceeded the timeout.
- (void)connectWithTimeoutInterval:(NSTimeInterval)timeout completionHandler:(YLTCPSocketCompletionBlock)completionBlockParameters
- timeout
The timeout interval for the operation, in seconds.
- completionBlock
A socket completion block.
Availability
1.0.0
Discussion
The operation runs entirely within its own GCD dispatch_queue and it calls the completion handler on the main queue when it finishes.
Declared In
YLTCPSocket.hinitWithHostname:port:
Initializes a TCP socket with an endpoint’s name and port number.
- (id)initWithHostname:(NSString *)hostname port:(SInt32)portParameters
- hostname
The hostname of the remote endpoint.
- port
The TCP port number to which the socket should connect.
Availability
1.0.0
Declared In
YLTCPSocket.h