Contents

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