public class SSLSocket implements AutoClosable:
import klyn.net.ssl
socket = SSLSocket("example.com", 443)
print(socket.protocol)
print(socket.cipherSuite)
socket.close()| Modifier and Type | Member | Description |
|---|---|---|
| public | SSLSocket(socket | Wraps an already-connected TCP socket into TLS. |
| public static | fromSocket(socketfromSocket(socket as Socket, |
Stable alias of `upgrade(. |
| public static | upgrade(socketupgrade(socket as Socket, |
Upgrades an already-connected TCP socket to TLS. |
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | cipherSuitecipherSuite as String: |
Negotiated cipher suite. |
| public readonly property | contextcontext as SSLContext: |
TLS context applied to this socket. |
| public readonly property | hosthost as String: |
Remote host name. |
| public readonly property | isConnectedisConnected as Boolean: |
True when the socket is connected. |
| public readonly property | portport as Int: |
Remote port number. |
| public readonly property | protocolprotocol as String: |
Negotiated TLS protocol, for example `TLSv1. |
| public readonly property | readerreader as SSLSocketReader: |
Read-only alias for `getReader()`. |
| public readonly property | writerwriter as SSLSocketWriter: |
Read-only alias for `getWriter()`. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | SSLSocketSSLSocket(context as SSLContext = null): |
Creates an unconnected TLS socket. |
| public | SSLSocketSSLSocket(host as String, port as Int, context as SSLContext = null) throws SSLException: |
Creates and connects a TLS socket. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | attachToSocketattachToSocket(socket as Socket, host as String, port as Int) as Void throws SSLException: |
Upgrades an already-connected TCP socket using this TLS context. |
| public override | closeclose() as Void: |
Closes the TLS socket. |
| public | connectconnect(host as String, port as Int) as Void throws SSLException: |
Connects this TLS socket. |
| public | getInputStreamgetInputStream() as SSLSocketInputStream: |
Returns the input stream facade. |
| public | getOutputStreamgetOutputStream() as SSLSocketOutputStream: |
Returns the output stream facade. |
| public | getReadergetReader() as SSLSocketReader: |
Returns the text reader facade. |
| public | getWritergetWriter() as SSLSocketWriter: |
Returns the text writer facade. |
| public | readAllTextreadAllText() as String throws SSLException: |
Reads until the peer closes the TLS stream. |
| public | readLinereadLine() as String throws SSLException: |
Reads one logical line. |
| public | receivereceive(maxBytes as Int = 4096) as String throws SSLException: |
Receives up to `maxBytes` bytes interpreted as text. |
| public | receiveBytesreceiveBytes(maxBytes as Int = 4096) as Byte[] throws SSLException: |
Receives raw bytes from the peer. |
| public | sendsend(value as String) as Boolean throws SSLException: |
Sends text to the peer. |
| public | sendBytessendBytes(value as Byte[]) as Int throws SSLException: |
Sends raw bytes to the peer. |
| public override | toStringtoString() as String: |
No summary. |
| public | writewrite(value as String) as Void throws SSLException: |
Writes text to the peer. |
| public | writeByteswriteBytes(value as Byte[]) as Void throws SSLException: |
Writes raw bytes to the peer. |
| public | writeLinewriteLine(value as String) as Void throws SSLException: |
Writes one line to the peer. |