AdapterSocket
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Connect to remote according to the
ConnectSession.Declaration
Swift
open func openSocketWith(session: ConnectSession)Parameters
sessionThe connect session.
-
The underlying TCP socket transmitting data.
Declaration
Swift
open var socket: RawTCPSocketProtocol! -
The delegate instance.
Declaration
Swift
weak open var delegate: SocketDelegate? -
Undocumented
-
The current connection status of the socket.
Declaration
Swift
public var status: SocketStatus -
Undocumented
-
Undocumented
-
Read data from the socket.
Warning
This should only be called after the last read is finished, i.e.,delegate?.didReadData()is called.Declaration
Swift
open func readData() -
Send data to remote.
Warning
This should only be called after the last write is finished, i.e.,delegate?.didWriteData()is called.Declaration
Swift
open func write(data: Data)Parameters
dataData to send.
-
Disconnect the socket elegantly.
Declaration
Swift
open func disconnect(becauseOf error: Error? = nil) -
Disconnect the socket immediately.
Declaration
Swift
open func forceDisconnect(becauseOf error: Error? = nil)
-
The socket did disconnect.
Declaration
Swift
open func didDisconnectWith(socket: RawTCPSocketProtocol)Parameters
socketThe socket which did disconnect.
-
The socket did read some data.
Declaration
Swift
open func didRead(data: Data, from: RawTCPSocketProtocol)Parameters
dataThe data read from the socket.
fromThe socket where the data is read from.
-
The socket did send some data.
Declaration
Swift
open func didWrite(data: Data?, by: RawTCPSocketProtocol)Parameters
dataThe data which have been sent to remote (acknowledged). Note this may not be available since the data may be released to save memory.
byThe socket where the data is sent out.
-
The socket did connect to remote.
Declaration
Swift
open func didConnectWith(socket: RawTCPSocketProtocol)Parameters
socketThe connected socket.
View on GitHub
AdapterSocket Class Reference