TCPSocket → SocketCore → Object

SSLSocket Class

Use the SSLSocket control to do secure communications via TCP/IP using secure sockets layer (SSL) technology. The SSLSocket control is available only in the Professional version of REALbasic.

Properties
CertificateFile
CertificatePassword
CertificateRejectionFile
ConnectionType
Secure
SSLConnected
SSLConnecting

# Notes

The Standard version of REALbasic does not compile references to the SSLSocket control.

To establish an SSL connection, set the Secure property to True and use the Connect method. SSLSocket does not support secure listening sockets.

The SSLSocket control is not listed in the Controls pane in the Window Editor. There are two ways to add an SSLSocket control to a window:

Drag a TCPSocket control to a window and then change its Super class to SSLSocket.

Display the window's contextual menu by right+clicking (Windows and Linux) or control-clicking on the window (Macintosh) and then choosing Add . SocketCore . TCPSocket . SSLSocket.

The SSLSocket control can be instantiated via code since it is not a subclass of Control. This allows you to easily write code that does communications without adding the control to a window.

Writing to a socket is done asynchronously. This means each time the Write method is called, the data passed goes into a buffer in memory before actually being sent and then removed from the buffer. Once the socket has finished sending the data in the buffer to the computer at the other end of the socket connection, the SendComplete event handler is executed. This allows you to know when all of the data has really been sent.

Calling Read, ReadAll, or Lookahead may not fetch all of the data in the internal buffer. This is because SSL needs to read data in blocks (due to the cryptography), and it may not have a complete block in the buffer. For example, there may be 700 bytes available in the buffer, but SSL can only decrypt 512 bytes due to the remainder being an incomplete block. What occurs in this case is some data may remain stagnant in the buffer. When more data comes in, REALbasic executes a DataAvailable event. If there are no more DataAvailable events, then upon disconnection, REALbasic will execute additional DataAvailable events to let you pick up any stagnant data that SSL can give us back. There are two things to watch out for because of this:

1) If there is not sufficient data for SSL to decrypt, you may get a DataAvailable event but no data.

2) Calling SSLSocket.Close may execute DataAvailable events.

If you are subclassing an SSLSocket, you must call the Super class's constructor in your subclass's constructor. The subclass will not work unless this is done.

# See Also

SocketCore, TCPSocket classes.