TCPListener

public final class TCPListener : TCPBase

Listener for TCP Connections

  • Create a new Listener

    Throws

    LwIP Error

    Declaration

    Swift

    public init(address: IP4Address, port: UInt16) throws

    Parameters

    address

    The address to bind to

    port

    The port to bind to

  • This handler will be called once a new connection has been accepted. The handler is responsible to set up the connection object properly and to call start(queue:)

    Declaration

    Swift

    public var acceptHandler: ((TCPConnection) -> Void)?
  • Listen for connections

    Throws

    LwIP Error

    Declaration

    Swift

    public func listen(backlog: UInt8) throws

    Parameters

    backlog

    The maximum number of connections which have not been accepted

  • Start dispatching events of the connection/listener and set the queue to deliver the events on.

    Declaration

    Swift

    public func start(queue: DispatchQueue)

    Parameters

    queue

    The queue to dispatch the events on