---
title: NSConnection
framework: foundation
role: symbol
role_heading: Class
path: foundation/nsconnection
---

# NSConnection

An object that manages the communication between objects in different threads or between a thread and a process running on a local or remote system.

## Declaration

```occ
@interface NSConnection : NSObject
```

## Overview

Overview Connection objects form the backbone of the distributed objects mechanism and normally operate in the background. You use the methods of NSConnection explicitly when vending an object to other applications, when accessing such a vended object through a proxy, and when altering default communication parameters. At other times, you simply interact with a vended object or its proxy. A single connection object may be shared by multiple threads and used to access a vended object.

## Topics

### Getting the Default Instance

- [defaultConnection](foundation/nsconnection/defaultconnection.md)

### Creating Instances

- [connectionWithReceivePort:sendPort:](foundation/nsconnection/connectionwithreceiveport:sendport:.md)
- [initWithReceivePort:sendPort:](foundation/nsconnection/initwithreceiveport:sendport:.md)

### Running the Connection in a New Thread

- [runInNewThread](foundation/nsconnection/runinnewthread.md)
- [enableMultipleThreads](foundation/nsconnection/enablemultiplethreads.md)
- [multipleThreadsEnabled](foundation/nsconnection/multiplethreadsenabled.md)
- [addRunLoop:](foundation/nsconnection/addrunloop:.md)
- [removeRunLoop:](foundation/nsconnection/removerunloop:.md)

### Vending a Service

- [serviceConnectionWithName:rootObject:usingNameServer:](foundation/nsconnection/serviceconnectionwithname:rootobject:usingnameserver:.md)
- [serviceConnectionWithName:rootObject:](foundation/nsconnection/serviceconnectionwithname:rootobject:.md)
- [registerName:](foundation/nsconnection/registername:.md)
- [registerName:withNameServer:](foundation/nsconnection/registername:withnameserver:.md)
- [rootObject](foundation/nsconnection/rootobject-c.property.md)

### Getting a Remote Object

- [connectionWithRegisteredName:host:](foundation/nsconnection/connectionwithregisteredname:host:.md)
- [connectionWithRegisteredName:host:usingNameServer:](foundation/nsconnection/connectionwithregisteredname:host:usingnameserver:.md)
- [rootProxy](foundation/nsconnection/rootproxy.md)
- [rootProxyForConnectionWithRegisteredName:host:](foundation/nsconnection/rootproxyforconnectionwithregisteredname:host:.md)
- [rootProxyForConnectionWithRegisteredName:host:usingNameServer:](foundation/nsconnection/rootproxyforconnectionwithregisteredname:host:usingnameserver:.md)
- [remoteObjects](foundation/nsconnection/remoteobjects.md)
- [localObjects](foundation/nsconnection/localobjects.md)

### Getting a Conversation

- [currentConversation](foundation/nsconnection/currentconversation.md)

### Getting All NSConnection Objects

- [allConnections](foundation/nsconnection/allconnections.md)

### Configuring Instances

- [requestTimeout](foundation/nsconnection/requesttimeout.md)
- [replyTimeout](foundation/nsconnection/replytimeout.md)
- [independentConversationQueueing](foundation/nsconnection/independentconversationqueueing.md)
- [addRequestMode:](foundation/nsconnection/addrequestmode:.md)
- [removeRequestMode:](foundation/nsconnection/removerequestmode:.md)
- [requestModes](foundation/nsconnection/requestmodes-c.property.md)
- [invalidate](foundation/nsconnection/invalidate.md)
- [valid](foundation/nsconnection/valid.md)

### Getting Ports

- [receivePort](foundation/nsconnection/receiveport-c.property.md)
- [sendPort](foundation/nsconnection/sendport-c.property.md)
- [dispatchWithComponents:](foundation/nsconnection/dispatchwithcomponents:.md)

### Getting Statistics

- [statistics](foundation/nsconnection/statistics-c.property.md)

### Setting the Delegate

- [delegate](foundation/nsconnection/delegate-c.property.md)

### Constants

- [NSConnection run loop mode](foundation/nsconnection-run-loop-mode.md)
- [Connection Exception Names](foundation/connection-exception-names.md)

### Notifications

- [NSConnectionDidDieNotification](foundation/nsconnectiondiddienotification.md)
- [NSConnectionDidInitializeNotification](foundation/nsconnectiondidinitializenotification.md)

### Instance Variables

- [authCheck](foundation/nsconnection/authcheck.md)
- [authGen](foundation/nsconnection/authgen.md)
- [busy](foundation/nsconnection/busy.md)
- [classInfoImported](foundation/nsconnection/classinfoimported.md)
- [delayedRL](foundation/nsconnection/delayedrl.md)
- [delegate](foundation/nsconnection/delegate-c.ivar.md)
- [doRequest](foundation/nsconnection/dorequest.md)
- [invalidateRP](foundation/nsconnection/invalidaterp.md)
- [isDead](foundation/nsconnection/isdead.md)
- [isMulti](foundation/nsconnection/ismulti.md)
- [isQueueing](foundation/nsconnection/isqueueing.md)
- [isValid](foundation/nsconnection/isvalid.md)
- [localProxyCount](foundation/nsconnection/localproxycount.md)
- [receivePort](foundation/nsconnection/receiveport-c.ivar.md)
- [registerInfo](foundation/nsconnection/registerinfo.md)
- [releasedProxies](foundation/nsconnection/releasedproxies.md)
- [replMode](foundation/nsconnection/replmode.md)
- [requestModes](foundation/nsconnection/requestmodes-c.ivar.md)
- [reserved](foundation/nsconnection/reserved.md)
- [rootObject](foundation/nsconnection/rootobject-c.ivar.md)
- [runLoops](foundation/nsconnection/runloops.md)
- [sendPort](foundation/nsconnection/sendport-c.ivar.md)
- [statistics](foundation/nsconnection/statistics-c.ivar.md)
- [waitCount](foundation/nsconnection/waitcount.md)
- [wantsInvalid](foundation/nsconnection/wantsinvalid.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

## See Also

### Legacy

- [NSMachPortDelegate](foundation/nsmachportdelegate.md)
- [NSConnectionDelegate](foundation/nsconnectiondelegate.md)
- [NSDistantObject](foundation/nsdistantobject.md)
- [NSDistantObjectRequest](foundation/nsdistantobjectrequest.md)
- [NSMachBootstrapServer](foundation/nsmachbootstrapserver.md)
- [NSMachPort](foundation/nsmachport.md)
- [MessagePort](foundation/messageport.md)
- [NSMessagePortNameServer](foundation/nsmessageportnameserver.md)
- [NSPortCoder](foundation/nsportcoder.md)
- [PortDelegate](foundation/portdelegate.md)
- [PortMessage](foundation/portmessage.md)
- [NSPortNameServer](foundation/nsportnameserver.md)
- [NSProtocolChecker](foundation/nsprotocolchecker.md)
- [NSSocketPortNameServer](foundation/nssocketportnameserver.md)
