An object you use to send and receive custom Ethernet frames.


final class NWEthernetChannel


Use Ethernet channels to send and receive custom Ethernet frame types over an interface.

Creating Ethernet channels requires the entitlement.


Managing Ethernet Channels

init(on: NWInterface, etherType: UInt16)

Initializes an Ethernet channel on a specific interface with a custom Ethernet type.

func start(queue: DispatchQueue)

Starts the process of registering the channel, and sets the queue on which all channel events are delivered.

func cancel()

Unregisters the channel from the interface.

Handling State Updates

var state: NWEthernetChannel.State

The current state of the channel.

enum NWEthernetChannel.State

States indicating whether an Ethernet channel is able to send and receive frames.

var stateUpdateHandler: ((NWEthernetChannel.State) -> Void)?

A handler that delivers channel state updates.

Sending and Receiving Ethernet Frames

Inspecting Ethernet Channels

let etherType: UInt16

The custom Ethernet type with which the channel was initialized.

let interface: NWInterface

The interface with which the channel was initialized.

var queue: DispatchQueue?

The queue on which channel events will be delivered.

var debugDescription: String

The description of the Ethernet channel.


See Also

Connections and Listeners

class NWConnection

A bidirectional data connection between a local endpoint and a remote endpoint.

class NWListener

An object you use to listen for incoming network connections.

class NWBrowser

An object you use to browse for available network services.