RawTCPSocketDelegate

public protocol RawTCPSocketDelegate: class

The delegate protocol to handle the events from a raw TCP socket.

  • The socket did disconnect.

    This should only be called once in the entire lifetime of a socket. After this is called, the delegate will not receive any other events from that socket and the socket should be released.

    Declaration

    Swift

    func didDisconnectWith(socket: RawTCPSocketProtocol)

    Parameters

    socket

    The socket which did disconnect.

  • The socket did read some data.

    Declaration

    Swift

    func didRead(data: Data, from: RawTCPSocketProtocol)

    Parameters

    data

    The data read from the socket.

    from

    The socket where the data is read from.

  • The socket did send some data.

    Declaration

    Swift

    func didWrite(data: Data?, by: RawTCPSocketProtocol)

    Parameters

    data

    The data which have been sent to remote (acknowledged). Note this may not be available since the data may be released to save memory.

    by

    The socket where the data is sent out.

  • The socket did connect to remote.

    Declaration

    Swift

    func didConnectWith(socket: RawTCPSocketProtocol)

    Parameters

    socket

    The connected socket.