TLSOutputStream
class TLSOutputStream : WrappedOutputStream, TlsSessionDelegate
This class is TLS encrypted output stream.
-
The TLS session
Declaration
Swift
let session: TlsSession -
The status of the stream.
Declaration
Swift
var status: Stream.Status -
An error that might have occurred.
Declaration
Swift
var error: Error? -
Initialize a TLS encrypted output stream with a given TLS session.
Declaration
Swift
init(_ stream: OutputStream, withSession session: TlsSession)Parameters
streamThe wrapped output stream.
sessionThe TLS session.
-
Get the status for the stream.
Declaration
Swift
override var streamStatus: Stream.Status { get } -
Get the error for the stream.
Declaration
Swift
override var streamError: Error? { get } -
Open the stream. The stream will actually open after the TLS handshake is completed. This will initiate a handshake.
See
Stream.open()Declaration
Swift
override func open() -
Tries to gracefully close the TLS stream.
See
Stream.close()Declaration
Swift
override func close() -
Get a property for a given key. This is a no-op and does nothing.
Declaration
Swift
override func property(forKey key: Stream.PropertyKey) -> Any?Parameters
keyThe name of the property.
Return Value
This always returns
nil. -
Set a property for a given key to a given value. This is a no-op and does nothing.
Declaration
Swift
override func setProperty(_ property: Any?, forKey key: Stream.PropertyKey) -> BoolParameters
propertyThe value of the property.
keyThe name of the property.
Return Value
This always returns
false.
-
Indicates whether space is available on the wrapped output stream.
Declaration
Swift
override var hasSpaceAvailable: Bool { get } -
Write bytes to the wrapped output stream. The bytes will be encrypted.
Declaration
Swift
override func write(_ dataPtr: UnsafePointer<UInt8>, maxLength: Int) -> IntParameters
dataPtrA pointer to the buffer, from which the bytes should be written.
maxLengthThe maximum lenghts of bytes to be written.
Return Value
The amount of bytes actually written.
-
Delegate function for the wrapped stream.
Declaration
Swift
override func stream(_ aStream: Stream, handle eventCode: Stream.Event)Parameters
aStreamThe stream calling the delegate. Has to be the wrapped output stream.
eventCodeThe event that occurred.
-
This function is called, once a TLS session was established, i.e., after the TLS handshake was successfully performed. It indicates that the implementing stream’s state can be set to
open.Declaration
Swift
func finishOpen() -
This function is called, once an error occurs.
Declaration
Swift
func setError(_ error: TlsStreamError)
View on GitHub
TLSOutputStream Class Reference