<!--
{
  "availability" : [
    "iOS: 4.2.0 -",
    "iPadOS: 4.2.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMIDI",
  "identifier" : "/documentation/CoreMIDI/MIDINetworkSession",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core MIDI"
    ],
    "preciseIdentifier" : "c:objc(cs)MIDINetworkSession"
  },
  "title" : "MIDINetworkSession"
}
-->

# MIDINetworkSession

An object that represents a pairing of a source and destination.

```
class MIDINetworkSession
```

## Overview

A session can have any number of connections. The system broadcasts output to all connections, and merges input from multiple connections.

## Topics

### Configuring a Session

[`+  defaultSession`](/documentation/CoreMIDI/MIDINetworkSession/default())

Returns the default singleton session.

[`enabled`](/documentation/CoreMIDI/MIDINetworkSession/isEnabled)

A Boolean value that determines whether the session is enabled.

[`connectionPolicy`](/documentation/CoreMIDI/MIDINetworkSession/connectionPolicy)

The policy that determines who can connect to this session.

### Inspecting a Sessions

[`localName`](/documentation/CoreMIDI/MIDINetworkSession/localName)

The name of this session’s entity.

[`networkName`](/documentation/CoreMIDI/MIDINetworkSession/networkName)

The name with which this session advertises itself over Bonjour.

[`networkPort`](/documentation/CoreMIDI/MIDINetworkSession/networkPort)

The session’s UDP port.

[`-  sourceEndpoint`](/documentation/CoreMIDI/MIDINetworkSession/sourceEndpoint())

Returns the session’s source endpoint.

[`-  destinationEndpoint`](/documentation/CoreMIDI/MIDINetworkSession/destinationEndpoint())

Returns the session’s destination endpoint.

### Managing Connections

[`-  connections`](/documentation/CoreMIDI/MIDINetworkSession/connections())

Returns the session’s set of MIDI network connections.

[`-  addConnection:`](/documentation/CoreMIDI/MIDINetworkSession/addConnection(_:))

Adds a new connection to this session.

[`-  removeConnection:`](/documentation/CoreMIDI/MIDINetworkSession/removeConnection(_:))

Removes a connection from this session.

### Managing Contacts

[`-  contacts`](/documentation/CoreMIDI/MIDINetworkSession/contacts())

Returns the array of network hosts.

[`-  addContact:`](/documentation/CoreMIDI/MIDINetworkSession/addContact(_:))

Adds a host as a contact.

[`-  removeContact:`](/documentation/CoreMIDI/MIDINetworkSession/removeContact(_:))

Removes a host as a contact.

[`MIDINetworkNotificationContactsDidChange`](/documentation/CoreMIDI/MIDINetworkNotificationContactsDidChange)

Indicates that the list of contacts changed.

### Observing State Changes

[`MIDINetworkNotificationSessionDidChange`](/documentation/CoreMIDI/MIDINetworkNotificationSessionDidChange)

Indicates that other aspects of the session changed, such as the connection list, connection policy, and so on.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)