SwiftDSSocketDelegate
@objc public protocol SwiftDSSocketDelegate
delegate methods for each operation
-
delegate method called after reading data from socket
Declaration
Swift
@objc optional func socket(sock: SwiftDSSocket, didRead data: Data, tag: Int)Parameters
sockSwiftDSSocket instance
datadata read from stream
taga tag to mark this read operation
-
delegate method called after reading partial data for specified data length from socket which allows users to know the progress of transfer
Declaration
Swift
@objc optional func socket(sock: SwiftDSSocket, didPartialRead totalCount: Int, tag: Int)Parameters
sockSwiftDSSocket instance
totalCountnumber of bytes read
taga tag to mark this read operation
-
delegate method called after reading data from socket
Declaration
Swift
@objc optional func socket(sock: SwiftDSSocket, didWrite tag: Int)Parameters
sockSwiftDSSocket instance
taga tag to mark this write operation
-
delegate method called after writing partial data for specified data length to socket which allows users to know the progress of transfer
Declaration
Swift
@objc optional func socket(sock: SwiftDSSocket, didPartialWrite totalCount: Int, tag: Int)Parameters
sockSwiftDSSocket instance
totalCountnumber of bytes read
taga tag to mark this write operation
-
delegate method called after closing connection
Declaration
Swift
@objc optional func socket(sock: SwiftDSSocket, didCloseConnection error: SwiftDSSocket.SocketError?)Parameters
sockSwiftDSSocket instance
errorSocketError indicates the reason why it gets closed
-
delegate method called after the connection to destination is established
Declaration
Swift
@objc optional func socket(sock: SwiftDSSocket, didConnectToHost host: String, port: UInt16)Parameters
sockSwiftDSSocket instance
hosthost address in
Stringportport number in UInt16
-
delegate method called after an incoming connection is accepted
Declaration
Swift
@objc optional func socket(sock: SwiftDSSocket, didAcceptNewSocket newSocket: SwiftDSSocket)Parameters
sockSwiftDSSocket instance
newSocketSwiftDSSocket instance for peer socket
SwiftDSSocketDelegate Protocol Reference