Instance Method

initWithTCPPort:

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

Declaration

- (instancetype)initWithTCPPort:(unsigned short)port;

Parameters

port

The port number for the newly created socket port to listen on. If port is 0, the system will assign a port number.

Return Value

An initialized local TCP/IP socket of type SOCK_STREAM, listening on port port.

Discussion

This method creates an IPv4 port, not an IPv6 port.

See Also

Creating Instances

- init

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

- initWithProtocolFamily:socketType:protocol:address:

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

- initWithProtocolFamily:socketType:protocol:socket:

Initializes the receiver with a previously created local socket.

- initRemoteWithTCPPort:host:

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

- initRemoteWithProtocolFamily:socketType:protocol:address:

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