Class

SocketPort

NSSocketPort is a subclass of NSPort that represents a BSD socket. An NSSocketPort object can be used as an endpoint for distributed object connections. Companion classes, NSMachPort and NSMessagePort, allow for local (on the same machine) communication only. The NSSocketPort class allows for both local and remote communication, but may be more expensive than the others for the local case.

Overview

Symbols

Creating Instances

init()

Initializes the receiver as a local TCP/IP socket of type SOCK_STREAM.

init?(tcpPort: UInt16)

Initializes the receiver as a local TCP/IP socket of type SOCK_STREAM, listening on a specified port number.

init?(protocolFamily: Int32, socketType: Int32, protocol: Int32, address: Data)

Initializes the receiver as a local socket with the provided arguments.

init?(protocolFamily: Int32, socketType: Int32, protocol: Int32, socket: SocketNativeHandle)

Initializes the receiver with a previously created local socket.

init?(remoteWithTCPPort: UInt16, host: String?)

Initializes the receiver as a TCP/IP socket of type SOCK_STREAM that can connect to a remote host on a specified port.

init(remoteWithProtocolFamily: Int32, socketType: Int32, protocol: Int32, address: Data)

Initializes the receiver as a remote socket with the provided arguments.

Getting Information

var address: Data

The receiver’s socket address structure stored inside an NSData object.

var `protocol`: Int32

The protocol that the receiver uses for communication.

var protocolFamily: Int32

The protocol family that the receiver uses for communication.

var socket: SocketNativeHandle

The receiver’s native socket identifier on the platform.

var socketType: Int32

The receiver’s socket type.

Relationships

Inherits From

Conforms To