TCPSecureSocket
Secure SSL TCP/IP socket
Operations
- New
- Close
- Flush
- GetAddress
- GetCertFingerprint
- GetIssuer
- GetLastError
- GetPort
- GetSubject
- IsOpen
- ReadBuffer
- ReadByte
- ReadLine
- Select
- SetKeepAlive
- SetMinTLSVersion
- SetNoDelay
- SetRecvBufferSize
- SetRecvTimeout
- SetSendBufferSize
- SetSendTimeout
- SetVerifyPeer
- WriteBuffer
- WriteByte
- WriteString
Flush #
Flushes the output buffer. This is a no-opt given this socket is not backed by an output buffer.
method : public : Flush() ~ NilGetAddress #
Returns the connected network address
method : public : GetAddress() ~ StringReturn
| Type | Description |
|---|---|
| String | return network address |
GetCertFingerprint #
Returns the SHA-256 fingerprint of the peer certificate as a hex string
method : public : GetCertFingerprint() ~ StringReturn
| Type | Description |
|---|---|
| String | 64-char hex fingerprint, or Nil if unavailable |
GetIssuer #
Gets the X.509 certificate issuer name
method : public : GetIssuer() ~ StringReturn
| Type | Description |
|---|---|
| String | certificate issuer name |
GetLastError # function
Get the last error
function : GetLastError() ~ StringReturn
| Type | Description |
|---|---|
| String | last error message, or Nil of no error |
GetPort #
Returns the connected network port
method : public : GetPort() ~ IntReturn
| Type | Description |
|---|---|
| Int | return network port |
GetSubject #
Gets the X.509 certificate subject name
method : public : GetSubject() ~ StringReturn
| Type | Description |
|---|---|
| String | certificate subject name |
IsOpen #
Returns rather the socket is open
method : public : IsOpen() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if socket is open, false otherwise |
New # constructor
Default constructor
New(address:System.String, port:Int, pem:String)Parameters
| Name | Type | Description |
|---|---|---|
| address | String | network address |
| port | Int | network port |
| pem | String | the Privacy Enhanced Mail file (optional) |
ReadBuffer #
Reads bytes into a byte buffer
method : public : ReadBuffer(offset:Int, num:Int, buffer:Byte[]) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| offset | Int | destination buffer offset |
| num | Int | number of values to read |
| buffer | Byte | input buffer |
Return
| Type | Description |
|---|---|
| Int | number of values read |
ReadBuffer #
Reads bytes into a character buffer
method : public : ReadBuffer(offset:Int, num:Int, buffer:Char[]) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| offset | Int | destination buffer offset |
| num | Int | number of values to read |
| buffer | Char | input buffer |
Return
| Type | Description |
|---|---|
| Int | number of values read |
ReadLine # native
Reads a string until a newline or character return is detected
method : public : native : ReadLine() ~ System.StringReturn
| Type | Description |
|---|---|
| String | character string |
Select #
Checks if read/write data is available
method : public : Select(is_write:Bool) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| is_write | Bool | if true check for write, otherwise read |
Return
| Type | Description |
|---|---|
| Int | 1 if ready, 0 if not ready, -1 is error |
SetKeepAlive #
Sets the TCP keep-alive option
method : public : SetKeepAlive(enable:Bool) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| enable | Bool | true to enable, false to disable |
Return
| Type | Description |
|---|---|
| Bool | true if successful |
SetMinTLSVersion #
Sets minimum TLS protocol version. Call before New() to take effect. Use mbedTLS MBEDTLS_SSL_VERSION_* constants.
method : public : SetMinTLSVersion(ver:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| ver | Int | TLS version constant |
Return
| Type | Description |
|---|---|
| Bool | true if successful |
SetNoDelay #
Disables Nagle's algorithm (TCP_NODELAY)
method : public : SetNoDelay(enable:Bool) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| enable | Bool | true to disable Nagle, false to re-enable |
Return
| Type | Description |
|---|---|
| Bool | true if successful |
SetRecvBufferSize #
Sets the receive buffer size
method : public : SetRecvBufferSize(bytes:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| bytes | Int | buffer size in bytes |
Return
| Type | Description |
|---|---|
| Bool | true if successful |
SetRecvTimeout #
Sets the receive timeout
method : public : SetRecvTimeout(ms:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| ms | Int | timeout in milliseconds |
Return
| Type | Description |
|---|---|
| Bool | true if successful |
SetSendBufferSize #
Sets the send buffer size
method : public : SetSendBufferSize(bytes:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| bytes | Int | buffer size in bytes |
Return
| Type | Description |
|---|---|
| Bool | true if successful |
SetSendTimeout #
Sets the send timeout
method : public : SetSendTimeout(ms:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| ms | Int | timeout in milliseconds |
Return
| Type | Description |
|---|---|
| Bool | true if successful |
SetVerifyPeer #
Enables strict peer certificate verification
method : public : SetVerifyPeer(strict:Bool) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| strict | Bool | true to require valid certificate chain |
Return
| Type | Description |
|---|---|
| Bool | true if successful |
WriteBuffer #
Writes bytes from a byte buffer
method : public : WriteBuffer(buffer:Byte[]) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| buffer | Byte | input buffer |
Return
| Type | Description |
|---|---|
| Int | number of values written |
WriteBuffer #
Writes bytes from a byte buffer
method : public : WriteBuffer(offset:Int, num:Int, buffer:Byte[]) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| offset | Int | destination buffer offset |
| num | Int | number of values to write |
| buffer | Byte | input buffer |
Return
| Type | Description |
|---|---|
| Int | number of values written |
WriteBuffer #
Writes characters from a byte buffer
method : public : WriteBuffer(buffer:Char[]) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| buffer | Char | input buffer |
Return
| Type | Description |
|---|---|
| Int | number of values written |
WriteBuffer #
Writes characters from a character buffer
method : public : WriteBuffer(offset:Int, num:Int, buffer:Char[]) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| offset | Int | destination buffer offset |
| num | Int | number of values to write |
| buffer | Char | input buffer |
Return
| Type | Description |
|---|---|
| Int | number of values written |