FMIceLinkTcpSocket Class Reference
| Inherits from | FMIceLinkStreamSocket : FMIceLinkManagedSocket : NSObject | 
|---|---|
| Conforms to | FMIceLinkAsyncSocketDelegate | 
| Declared in | FMIceLinkTcpSocket.h FMIceLinkTcpSocket.m  | 
– server
	- (bool)serverDiscussion
Declared In
FMIceLinkStreamSocket.h
– secure
	- (bool)secureDiscussion
Declared In
FMIceLinkStreamSocket.h
– ipv6
	- (bool)ipv6Discussion
Declared In
FMIceLinkManagedSocket.h
– isClosed
	- (bool)isClosedDiscussion
Declared In
FMIceLinkManagedSocket.h
– localIPAddress
	- (NSString *)localIPAddressDiscussion
Declared In
FMIceLinkManagedSocket.h
– localPort
	- (int)localPortDiscussion
Declared In
FMIceLinkManagedSocket.h
– remoteIPAddress
	- (NSString *)remoteIPAddressDiscussion
Declared In
FMIceLinkStreamSocket.h
– remotePort
	- (int)remotePortDiscussion
Declared In
FMIceLinkStreamSocket.h
– bindWithIPAddress:port:addressInUse:
	- (bool)bindWithIPAddress:(NSString *)ipAddress port:(int)port addressInUse:(bool *)addressInUseParameters
ipAddress | 
						The local IP address.  | 
					
|---|---|
port | 
						The local port.  | 
					
addressInUse | 
						Indicates that access to the address is forbidden or in use.  | 
					
Discussion
Declared In
FMIceLinkManagedSocket.h
– acceptAsyncWithOnSuccess:onFailure:onSocket:
	- (void)acceptAsyncWithOnSuccess:(FMIceLinkAction0 *)onSuccess onFailure:(FMIceLinkAction1 *)onFailure onSocket:(FMIceLinkAction1 *)onSocketParameters
onSuccess | 
						The callback to invoke on success.  | 
					
|---|---|
onFailure | 
						The callback to invoke on failure.  | 
					
onSocket | 
						The callback to invoke when a socket is ready.  | 
					
Discussion
Declared In
FMIceLinkStreamSocket.h
– socket:didAcceptNewSocket:
	Called when a socket accepts a connection. Another socket is automatically spawned to handle it.
- (void)socket:(FMIceLinkAsyncSocket *)sock didAcceptNewSocket:(FMIceLinkAsyncSocket *)newSocketDiscussion
Called when a socket accepts a connection. Another socket is automatically spawned to handle it.
You must retain the newSocket if you wish to handle the connection. Otherwise the newSocket instance will be released and the spawned connection will be closed.
By default the new socket will have the same delegate and delegateQueue. You may, of course, change this at any time.
Declared In
FMIceLinkAsyncSocket.h
– connectAsyncWithHostname:ipAddress:port:timeout:onSuccess:onFailure:
	- (void)connectAsyncWithHostname:(NSString *)hostname ipAddress:(NSString *)ipAddress port:(int)port timeout:(int)timeout onSuccess:(FMIceLinkAction0 *)onSuccess onFailure:(FMIceLinkAction2 *)onFailureParameters
hostname | 
						The remote hostname.  | 
					
|---|---|
ipAddress | 
						The remote IP address.  | 
					
port | 
						The remote port.  | 
					
timeout | 
						The timeout (in ms).  | 
					
onSuccess | 
						The callback to invoke on success.  | 
					
onFailure | 
						The callback to invoke on failure.  | 
					
Discussion
Declared In
FMIceLinkStreamSocket.h
– socket:didConnectToHost:port:
	Called when a socket connects and is ready for reading and writing. The host parameter will be an IP address, not a DNS name.
- (void)socket:(FMIceLinkAsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)portDiscussion
Called when a socket connects and is ready for reading and writing. The host parameter will be an IP address, not a DNS name.
Declared In
FMIceLinkAsyncSocket.h
– socketDidSecure:
	Called after the socket has successfully completed SSL/TLS negotiation. This method is not called unless you use the provided startTLS method.
- (void)socketDidSecure:(FMIceLinkAsyncSocket *)sockDiscussion
Called after the socket has successfully completed SSL/TLS negotiation. This method is not called unless you use the provided startTLS method.
If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close, and the socketDidDisconnect:withError: delegate method will be called with the specific SSL error code.
Declared In
FMIceLinkAsyncSocket.h
– receiveAsyncWithTimeout:
	- (void)receiveAsyncWithTimeout:(int)timeoutParameters
timeout | 
						The timeout (in ms).  | 
					
|---|
Discussion
Declared In
FMIceLinkStreamSocket.h
– socket:didReadData:withTag:
	Called when a socket has completed reading the requested data into memory. Not called if there is an error.
- (void)socket:(FMIceLinkAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tagDiscussion
Called when a socket has completed reading the requested data into memory. Not called if there is an error.
Declared In
FMIceLinkAsyncSocket.h
– sendWithBuffer:
	- (bool)sendWithBuffer:(FMIceLinkDataBuffer *)bufferParameters
buffer | 
						The buffer.  | 
					
|---|
Discussion
Declared In
FMIceLinkStreamSocket.h
– sendAsyncWithBuffer:timeout:onSuccess:onFailure:
	- (void)sendAsyncWithBuffer:(FMIceLinkDataBuffer *)buffer timeout:(int)timeout onSuccess:(FMIceLinkAction0 *)onSuccess onFailure:(FMIceLinkAction2 *)onFailureParameters
buffer | 
						The buffer.  | 
					
|---|---|
timeout | 
						The timeout (in ms).  | 
					
onSuccess | 
						The callback to invoke on success.  | 
					
onFailure | 
						The callback to invoke on failure.  | 
					
Discussion
Declared In
FMIceLinkStreamSocket.h
– socket:didWriteDataWithTag:
	Called when a socket has completed writing the requested data. Not called if there is an error.
- (void)socket:(FMIceLinkAsyncSocket *)sock didWriteDataWithTag:(long)tagDiscussion
Called when a socket has completed writing the requested data. Not called if there is an error.
Declared In
FMIceLinkAsyncSocket.h
– socketDidDisconnect:withError:
	Called when a socket disconnects with or without error.
- (void)socketDidDisconnect:(FMIceLinkAsyncSocket *)sock withError:(NSError *)errDiscussion
Called when a socket disconnects with or without error.
If you call the disconnect method, and the socket wasn’t already disconnected, then an invocation of this delegate method will be enqueued on the delegateQueue before the disconnect method returns.
Note: If the FMIceLinkAsyncSocket instance is deallocated while it is still connected, and the delegate is not also deallocated, then this method will be invoked, but the sock parameter will be nil. (It must necessarily be nil since it is no longer available.) This is a generally rare, but is possible if one writes code like this:
asyncSocket = nil; // I’m implicitly disconnecting the socket
In this case it may preferrable to nil the delegate beforehand, like this:
asyncSocket.delegate = nil; // Don’t invoke my delegate method asyncSocket = nil; // I’m implicitly disconnecting the socket
Of course, this depends on how your state machine is configured.
Declared In
FMIceLinkAsyncSocket.h
– close
	- (void)closeDiscussion
Declared In
FMIceLinkManagedSocket.h