FMLiveSwitchStreamSocket Class Reference

A stream socket. More...

Instance Methods

(void) - acceptAsyncWithOnSuccess:onFailure:onSocket:
 Accepts a new socket asynchronously. More...
 
(void) - acceptAsyncWithOnSuccessBlock:onFailureBlock:onSocketBlock:
 Accepts a new socket asynchronously. More...
 
(FMLiveSwitchStreamSocket *) - acceptAsyncWithOnSuccessBlockAndOnFailureBlockAndOnSocketBlock
 Accepts a new socket asynchronously. More...
 
(void) - connectAsyncWithHostname:ipAddress:port:timeout:onSuccess:onFailure:
 Connects the socket asynchronously. More...
 
(void) - connectAsyncWithHostname:ipAddress:port:timeout:onSuccessBlock:onFailureBlock:
 Connects the socket asynchronously. More...
 
(NSException *, bool) - connectAsyncWithHostnameAndIPAddressAndPortAndTimeoutAndOnSuccessBlockAndOnFailureBlock
 Connects the socket asynchronously. More...
 
(instancetype) - init
 
(FMLiveSwitchAction2< NSException *, id > *) - onReceiveFailure
 Gets a callback invoked on failed read from TCP stream. More...
 
(FMLiveSwitchAction1< FMLiveSwitchDataBuffer * > *) - onReceiveSuccess
 Gets a callback invoked on successful read from TCP stream. More...
 
(void) - raiseAcceptFailureWithCallback:exception:
 Invokes the accept failure callback. More...
 
(void) - raiseAcceptFailureWithCallbackBlock:exception:
 Invokes the accept failure callback. More...
 
(NSException *) - raiseAcceptFailureWithCallbackBlockAndException
 Invokes the accept failure callback. More...
 
(void) - raiseAcceptSocketWithCallback:socket:
 Invokes the accept success callback. More...
 
(void) - raiseAcceptSocketWithCallbackBlock:socket:
 Invokes the accept success callback. More...
 
(FMLiveSwitchStreamSocket *) - raiseAcceptSocketWithCallbackBlockAndSocket
 Invokes the accept success callback. More...
 
(void) - raiseAcceptSuccessWithCallback:
 Invokes the accept success callback. More...
 
(void) - raiseConnectFailureWithCallback:exception:timedOut:
 Invokes the connect failure callback. More...
 
(void) - raiseConnectFailureWithCallbackBlock:exception:timedOut:
 Invokes the connect failure callback. More...
 
(NSException *, bool) - raiseConnectFailureWithCallbackBlockAndExceptionAndTimedOut
 Invokes the connect failure callback. More...
 
(void) - raiseConnectSuccessWithCallback:
 Invokes the connect success callback. More...
 
(void) - raiseReceiveFailureWithCallback:exception:timedOut:
 Invokes the receive failure callback. More...
 
(void) - raiseReceiveFailureWithCallbackBlock:exception:timedOut:
 Invokes the receive failure callback. More...
 
(NSException *, bool) - raiseReceiveFailureWithCallbackBlockAndExceptionAndTimedOut
 Invokes the receive failure callback. More...
 
(void) - raiseReceiveSuccessWithCallback:buffer:
 Invokes the receive success callback. More...
 
(void) - raiseReceiveSuccessWithCallbackBlock:buffer:
 Invokes the receive success callback. More...
 
(FMLiveSwitchDataBuffer *) - raiseReceiveSuccessWithCallbackBlockAndBuffer
 Invokes the receive success callback. More...
 
(void) - raiseSendFailureWithCallback:exception:timedOut:
 Invokes the send failure callback. More...
 
(void) - raiseSendFailureWithCallbackBlock:exception:timedOut:
 Invokes the send failure callback. More...
 
(NSException *, bool) - raiseSendFailureWithCallbackBlockAndExceptionAndTimedOut
 Invokes the send failure callback. More...
 
(void) - raiseSendSuccessWithCallback:
 Invokes the send success callback. More...
 
(void) - receiveAsyncWithTimeout:
 Receives data asynchronously. More...
 
(NSString *) - remoteHostname
 Gets the remote hostname. More...
 
(NSString *) - remoteIPAddress
 Gets the remote IP address. More...
 
(int) - remotePort
 Gets the remote port. More...
 
(bool) - secure
 Gets a value indicating whether the socket is secure. More...
 
(void) - sendAsyncWithBuffer:timeout:onSuccess:onFailure:
 Sends data asynchronously. More...
 
(void) - sendAsyncWithBuffer:timeout:onSuccessBlock:onFailureBlock:
 Sends data asynchronously. More...
 
(NSException *, bool) - sendAsyncWithBufferAndTimeoutAndOnSuccessBlockAndOnFailureBlock
 Sends data asynchronously. More...
 
(bool) - sendWithBuffer:
 Sends data synchronously. More...
 
(bool) - server
 Gets a value indicating whether the socket can accept incoming connections. More...
 
(void) - setOnReceiveFailure:
 Sets a callback invoked on failed read from TCP stream. More...
 
(NSException *, bool) - setOnReceiveFailureBlock
 Sets a callback invoked on failed read from TCP stream. More...
 
(void) - setOnReceiveFailureBlock:
 Sets a callback invoked on failed read from TCP stream. More...
 
(void) - setOnReceiveSuccess:
 Sets a callback invoked on successful read from TCP stream. More...
 
(FMLiveSwitchDataBuffer *) - setOnReceiveSuccessBlock
 Sets a callback invoked on successful read from TCP stream. More...
 
(void) - setOnReceiveSuccessBlock:
 Sets a callback invoked on successful read from TCP stream. More...
 
- Instance Methods inherited from FMLiveSwitchManagedSocket
(long long) - adapterSpeed
 Gets the adapter speed. More...
 
(bool) - bindWithIPAddress:port:addressInUse:
 Binds the socket to a local endpoint. More...
 
(void) - close
 Closes the socket. More...
 
(bool) - ipv6
 Gets a value indicating whether the socket supports IPv6. More...
 
(bool) - isClosed
 Gets a value indicating whether this instance is closed. More...
 
(NSString *) - localIPAddress
 Gets the local IP address. More...
 
(int) - localPort
 Gets the local port. More...
 
(NSMutableArray *) - publicIPAddresses
 Gets the public IP addresses, if known. More...
 
(void) - setAdapterSpeed:
 Sets the adapter speed. More...
 
(void) - setPublicIPAddresses:
 Sets the public IP addresses, if known. More...
 

Class Methods

(FMLiveSwitchStreamSocket *) + streamSocket
 
- Class Methods inherited from FMLiveSwitchManagedSocket
(FMLiveSwitchManagedSocket *) + managedSocket
 

Detailed Description

A stream socket.

Method Documentation

◆ acceptAsyncWithOnSuccess:onFailure:onSocket:

- (void) acceptAsyncWithOnSuccess: (FMLiveSwitchAction0 *)  onSuccess
onFailure: (FMLiveSwitchAction1< NSException * > *)  onFailure
onSocket: (FMLiveSwitchAction1< FMLiveSwitchStreamSocket * > *)  onSocket 

Accepts a new socket asynchronously.

Parameters
onSuccessThe callback to invoke on success.
onFailureThe callback to invoke on failure.
onSocketThe callback to invoke when a socket is ready.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ acceptAsyncWithOnSuccessBlock:onFailureBlock:onSocketBlock:

- (void) acceptAsyncWithOnSuccessBlock: (void(^)(void))  onSuccessBlock
onFailureBlock: (void(^)(NSException *))  onFailureBlock
onSocketBlock: (void(^)(FMLiveSwitchStreamSocket *))  onSocketBlock 

Accepts a new socket asynchronously.

Parameters
onSuccessBlockThe callback to invoke on success.
onFailureBlockThe callback to invoke on failure.
onSocketBlockThe callback to invoke when a socket is ready.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ acceptAsyncWithOnSuccessBlockAndOnFailureBlockAndOnSocketBlock

- (FMLiveSwitchStreamSocket*) acceptAsyncWithOnSuccessBlockAndOnFailureBlockAndOnSocketBlock

Accepts a new socket asynchronously.

@inlineparam onSuccessBlock The callback to invoke on success. @inlineparam onFailureBlock The callback to invoke on failure. @inlineparam onSocketBlock The callback to invoke when a socket is ready.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ connectAsyncWithHostname:ipAddress:port:timeout:onSuccess:onFailure:

- (void) connectAsyncWithHostname: (NSString *)  hostname
ipAddress: (NSString *)  ipAddress
port: (int)  port
timeout: (int)  timeout
onSuccess: (FMLiveSwitchAction0 *)  onSuccess
onFailure: (FMLiveSwitchAction2< NSException *, id > *)  onFailure 

Connects the socket asynchronously.

Parameters
hostnameThe remote hostname.
ipAddressThe remote IP address.
portThe remote port.
timeoutThe timeout (in ms).
onSuccessThe callback to invoke on success.
onFailureThe callback to invoke on failure.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ connectAsyncWithHostname:ipAddress:port:timeout:onSuccessBlock:onFailureBlock:

- (void) connectAsyncWithHostname: (NSString *)  hostname
ipAddress: (NSString *)  ipAddress
port: (int)  port
timeout: (int)  timeout
onSuccessBlock: (void(^)(void))  onSuccessBlock
onFailureBlock: (void(^)(NSException *, bool))  onFailureBlock 

Connects the socket asynchronously.

Parameters
hostnameThe remote hostname.
ipAddressThe remote IP address.
portThe remote port.
timeoutThe timeout (in ms).
onSuccessBlockThe callback to invoke on success.
onFailureBlockThe callback to invoke on failure.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ connectAsyncWithHostnameAndIPAddressAndPortAndTimeoutAndOnSuccessBlockAndOnFailureBlock

- (NSException*, bool) connectAsyncWithHostnameAndIPAddressAndPortAndTimeoutAndOnSuccessBlockAndOnFailureBlock

Connects the socket asynchronously.

@inlineparam hostname The remote hostname. @inlineparam ipAddress The remote IP address. @inlineparam port The remote port. @inlineparam timeout The timeout (in ms). @inlineparam onSuccessBlock The callback to invoke on success. @inlineparam onFailureBlock The callback to invoke on failure.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ init

- (instancetype) init

◆ onReceiveFailure

- (FMLiveSwitchAction2<NSException*,id>*) onReceiveFailure

Gets a callback invoked on failed read from TCP stream.

◆ onReceiveSuccess

- (FMLiveSwitchAction1<FMLiveSwitchDataBuffer*>*) onReceiveSuccess

Gets a callback invoked on successful read from TCP stream.

◆ raiseAcceptFailureWithCallback:exception:

- (void) raiseAcceptFailureWithCallback: (FMLiveSwitchAction1< NSException * > *)  callback
exception: (NSException *)  exception 

Invokes the accept failure callback.

Parameters
callbackThe callback.
exceptionThe exception.

◆ raiseAcceptFailureWithCallbackBlock:exception:

- (void) raiseAcceptFailureWithCallbackBlock: (void(^)(NSException *))  callbackBlock
exception: (NSException *)  exception 

Invokes the accept failure callback.

Parameters
callbackBlockThe callback.
exceptionThe exception.

◆ raiseAcceptFailureWithCallbackBlockAndException

- (NSException*) raiseAcceptFailureWithCallbackBlockAndException

Invokes the accept failure callback.

@inlineparam callbackBlock The callback. @inlineparam exception The exception.

◆ raiseAcceptSocketWithCallback:socket:

- (void) raiseAcceptSocketWithCallback: (FMLiveSwitchAction1< FMLiveSwitchStreamSocket * > *)  callback
socket: (FMLiveSwitchStreamSocket *)  socket 

Invokes the accept success callback.

Parameters
callbackThe callback.
socketThe socket.

◆ raiseAcceptSocketWithCallbackBlock:socket:

- (void) raiseAcceptSocketWithCallbackBlock: (void(^)(FMLiveSwitchStreamSocket *))  callbackBlock
socket: (FMLiveSwitchStreamSocket *)  socket 

Invokes the accept success callback.

Parameters
callbackBlockThe callback.
socketThe socket.

◆ raiseAcceptSocketWithCallbackBlockAndSocket

- (FMLiveSwitchStreamSocket*) raiseAcceptSocketWithCallbackBlockAndSocket

Invokes the accept success callback.

@inlineparam callbackBlock The callback. @inlineparam socket The socket.

◆ raiseAcceptSuccessWithCallback:

- (void) raiseAcceptSuccessWithCallback: (FMLiveSwitchAction0 *)  callback

Invokes the accept success callback.

Parameters
callbackThe callback.

◆ raiseConnectFailureWithCallback:exception:timedOut:

- (void) raiseConnectFailureWithCallback: (FMLiveSwitchAction2< NSException *, id > *)  callback
exception: (NSException *)  exception
timedOut: (bool)  timedOut 

Invokes the connect failure callback.

Parameters
callbackThe callback.
exceptionThe exception.
timedOutif set to true [timed out].

◆ raiseConnectFailureWithCallbackBlock:exception:timedOut:

- (void) raiseConnectFailureWithCallbackBlock: (void(^)(NSException *, bool))  callbackBlock
exception: (NSException *)  exception
timedOut: (bool)  timedOut 

Invokes the connect failure callback.

Parameters
callbackBlockThe callback.
exceptionThe exception.
timedOutif set to true [timed out].

◆ raiseConnectFailureWithCallbackBlockAndExceptionAndTimedOut

- (NSException*, bool) raiseConnectFailureWithCallbackBlockAndExceptionAndTimedOut

Invokes the connect failure callback.

@inlineparam callbackBlock The callback. @inlineparam exception The exception. @inlineparam timedOut if set to true [timed out].

◆ raiseConnectSuccessWithCallback:

- (void) raiseConnectSuccessWithCallback: (FMLiveSwitchAction0 *)  callback

Invokes the connect success callback.

Parameters
callbackThe callback.

◆ raiseReceiveFailureWithCallback:exception:timedOut:

- (void) raiseReceiveFailureWithCallback: (FMLiveSwitchAction2< NSException *, id > *)  callback
exception: (NSException *)  exception
timedOut: (bool)  timedOut 

Invokes the receive failure callback.

Parameters
callbackThe callback.
exceptionThe exception.
timedOutif set to true [timed out].

◆ raiseReceiveFailureWithCallbackBlock:exception:timedOut:

- (void) raiseReceiveFailureWithCallbackBlock: (void(^)(NSException *, bool))  callbackBlock
exception: (NSException *)  exception
timedOut: (bool)  timedOut 

Invokes the receive failure callback.

Parameters
callbackBlockThe callback.
exceptionThe exception.
timedOutif set to true [timed out].

◆ raiseReceiveFailureWithCallbackBlockAndExceptionAndTimedOut

- (NSException*, bool) raiseReceiveFailureWithCallbackBlockAndExceptionAndTimedOut

Invokes the receive failure callback.

@inlineparam callbackBlock The callback. @inlineparam exception The exception. @inlineparam timedOut if set to true [timed out].

◆ raiseReceiveSuccessWithCallback:buffer:

- (void) raiseReceiveSuccessWithCallback: (FMLiveSwitchAction1< FMLiveSwitchDataBuffer * > *)  callback
buffer: (FMLiveSwitchDataBuffer *)  buffer 

Invokes the receive success callback.

Parameters
callbackThe callback.
bufferThe buffer.

◆ raiseReceiveSuccessWithCallbackBlock:buffer:

- (void) raiseReceiveSuccessWithCallbackBlock: (void(^)(FMLiveSwitchDataBuffer *))  callbackBlock
buffer: (FMLiveSwitchDataBuffer *)  buffer 

Invokes the receive success callback.

Parameters
callbackBlockThe callback.
bufferThe buffer.

◆ raiseReceiveSuccessWithCallbackBlockAndBuffer

- (FMLiveSwitchDataBuffer*) raiseReceiveSuccessWithCallbackBlockAndBuffer

Invokes the receive success callback.

@inlineparam callbackBlock The callback. @inlineparam buffer The buffer.

◆ raiseSendFailureWithCallback:exception:timedOut:

- (void) raiseSendFailureWithCallback: (FMLiveSwitchAction2< NSException *, id > *)  callback
exception: (NSException *)  exception
timedOut: (bool)  timedOut 

Invokes the send failure callback.

Parameters
callbackThe callback.
exceptionThe exception.
timedOutif set to true [timed out].

◆ raiseSendFailureWithCallbackBlock:exception:timedOut:

- (void) raiseSendFailureWithCallbackBlock: (void(^)(NSException *, bool))  callbackBlock
exception: (NSException *)  exception
timedOut: (bool)  timedOut 

Invokes the send failure callback.

Parameters
callbackBlockThe callback.
exceptionThe exception.
timedOutif set to true [timed out].

◆ raiseSendFailureWithCallbackBlockAndExceptionAndTimedOut

- (NSException*, bool) raiseSendFailureWithCallbackBlockAndExceptionAndTimedOut

Invokes the send failure callback.

@inlineparam callbackBlock The callback. @inlineparam exception The exception. @inlineparam timedOut if set to true [timed out].

◆ raiseSendSuccessWithCallback:

- (void) raiseSendSuccessWithCallback: (FMLiveSwitchAction0 *)  callback

Invokes the send success callback.

Parameters
callbackThe callback.

◆ receiveAsyncWithTimeout:

- (void) receiveAsyncWithTimeout: (int)  timeout

Receives data asynchronously.

Parameters
timeoutThe timeout (in ms).

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ remoteHostname

- (NSString*) remoteHostname

Gets the remote hostname.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ remoteIPAddress

- (NSString*) remoteIPAddress

Gets the remote IP address.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ remotePort

- (int) remotePort

Gets the remote port.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ secure

- (bool) secure

Gets a value indicating whether the socket is secure.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ sendAsyncWithBuffer:timeout:onSuccess:onFailure:

- (void) sendAsyncWithBuffer: (FMLiveSwitchDataBuffer *)  buffer
timeout: (int)  timeout
onSuccess: (FMLiveSwitchAction0 *)  onSuccess
onFailure: (FMLiveSwitchAction2< NSException *, id > *)  onFailure 

Sends data asynchronously.

Parameters
bufferThe buffer.
timeoutThe timeout (in ms).
onSuccessThe callback to invoke on success.
onFailureThe callback to invoke on failure.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ sendAsyncWithBuffer:timeout:onSuccessBlock:onFailureBlock:

- (void) sendAsyncWithBuffer: (FMLiveSwitchDataBuffer *)  buffer
timeout: (int)  timeout
onSuccessBlock: (void(^)(void))  onSuccessBlock
onFailureBlock: (void(^)(NSException *, bool))  onFailureBlock 

Sends data asynchronously.

Parameters
bufferThe buffer.
timeoutThe timeout (in ms).
onSuccessBlockThe callback to invoke on success.
onFailureBlockThe callback to invoke on failure.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ sendAsyncWithBufferAndTimeoutAndOnSuccessBlockAndOnFailureBlock

- (NSException*, bool) sendAsyncWithBufferAndTimeoutAndOnSuccessBlockAndOnFailureBlock

Sends data asynchronously.

@inlineparam buffer The buffer. @inlineparam timeout The timeout (in ms). @inlineparam onSuccessBlock The callback to invoke on success. @inlineparam onFailureBlock The callback to invoke on failure.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ sendWithBuffer:

- (bool) sendWithBuffer: (FMLiveSwitchDataBuffer *)  buffer

Sends data synchronously.

Parameters
bufferThe buffer.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ server

- (bool) server

Gets a value indicating whether the socket can accept incoming connections.

Implemented in FMLiveSwitchVirtualTcpSocket.

◆ setOnReceiveFailure:

- (void) setOnReceiveFailure: (FMLiveSwitchAction2< NSException *, id > *)  value

Sets a callback invoked on failed read from TCP stream.

◆ setOnReceiveFailureBlock

- (NSException*, bool) setOnReceiveFailureBlock

Sets a callback invoked on failed read from TCP stream.

◆ setOnReceiveFailureBlock:

- (void) setOnReceiveFailureBlock: (void(^)(NSException *, bool))  valueBlock

Sets a callback invoked on failed read from TCP stream.

◆ setOnReceiveSuccess:

- (void) setOnReceiveSuccess: (FMLiveSwitchAction1< FMLiveSwitchDataBuffer * > *)  value

Sets a callback invoked on successful read from TCP stream.

◆ setOnReceiveSuccessBlock

- (FMLiveSwitchDataBuffer*) setOnReceiveSuccessBlock

Sets a callback invoked on successful read from TCP stream.

◆ setOnReceiveSuccessBlock:

- (void) setOnReceiveSuccessBlock: (void(^)(FMLiveSwitchDataBuffer *))  valueBlock

Sets a callback invoked on successful read from TCP stream.

◆ streamSocket

+ (FMLiveSwitchStreamSocket*) streamSocket