Instance Method

streamTask(withHostName:port:)

Creates a task that establishes a bidirectional TCP/IP connection to a specified hostname and port.

Declaration

func streamTask(withHostName hostname: String, port: Int) -> URLSessionStreamTask

Parameters

hostname

The hostname of the connection endpoint.

port

The port of the connection endpoint.

Return Value

The new session stream task.

Discussion

After you create the task, you must start it by calling its resume() method.

See Also

Adding Stream Tasks to a Session

func streamTask(with: NetService)

Creates a task that establishes a bidirectional TCP/IP connection using a specified network service.

class URLSessionStreamTask

A URL session task that is stream-based.

protocol URLSessionStreamDelegate

The NSURLSessionStreamDelegate protocol defines delegate methods that you should implement when using URLSession stream tasks.