SSL authentication and encryption ensures your data stays private as it travels across the public network.

SecureTcp ActiveX Control

Use the SecureTcp control to automatically authenticate and encrypt/decrypt all data sent and received over a TCP connection using SSL2, SSL3, PCT, and TLS. Features include:

  • Select SSL 2.0, SSL 3.0, PCT, TLS or unencrypted TCP communications.
  • Customize certificate acceptance or rejection.
  • Client authentication fully supported.
  • TCP Send method sends data to the server.
  • TCP Receive method receives all available data.
  • TCP Search Method supports variable length records and line processing, eliminating the need to search for termination characters and simplifying buffer management.
  • TCP Fill Method supports fixed length binary records, simplifying buffer management and reducing the code needed to send and receive binary structures.
  • Proxy support, including Socks 4 and 5


Looking for the .NET version of this control?

Development Environments

  • Visual Studio .NET (.NET Framework)
  • Visual Basic (VB)
  • Visual C++ (VC++)
  • FoxPro
  • PowerBuilder
  • Delphi
  • C++ Builder
  • ASP
  • Office 97/2000




Public Properties
Blocked A True value indicates the control is currently executing a blocking method (Timeout is greater than 0), which has neither completed nor timed out with a ptTimeout error.
Certificate Certificate Object to use when authenticating to the remote host.
ClientAuthentication Applies to server operation only.
KeepAlive When set to True, the KEEPALIVE socket option is set to monitor dropped connections. This option can only be set when the State property is tcpConnected.
LocalAddress Returns the address of the local host in dot notation (for example, nnn.nnn.nnn.nnn). When not connected, it returns an empty string.
LocalPort Returns the port number that the socket is bound to. When not connected, it returns 0.
NoDelay When True, the NODELAY socket option is set to defeat Nagle's algorithm
Protocol Specifies the security protocol used.
ProxyHost Specifies the name or address of the proxy server that requests are to be routed through.
ProxyPassword Password to be sent on all requests through a proxy server that requires authentication.
ProxyPort Specifies the port used by proxy server that requests are to be routed through.
ProxyType The type of proxy server used for this connection.
ProxyUsername Username to be sent on all requests through a proxy server that requires authentication.
ReceiveBufferCount Checks for the existence of data without removing it.
ReceiveBufferSize Number of bytes the system has for buffering incoming data.
Ref Stores a reference to another object, data type, or value.
RemoteAddress Returns the address of the remote host in dot notation (i.e. nnn.nnn.nnn.nnn) when the State property is tcpConnected.
RemotePort Returns the port number of the remote host when the State property is tcpConnected.
ReuseAddress When True, the REUSEADDR socket option is set to accept duplicate use of the same LocalAddress / LocalPort pair (these are optional parameters of the Connect and Listen methods).
Security Sets the security level during communication.
SendBufferCount When the Send method is used, some data may be stored in a buffer and later submitted to the system. The Send event fires to indicate that the system has accepted the submitted data.
SendBufferSize Number of bytes the system uses for buffering outgoing data.
Socket System identifier assigned to the TCP connection. It is normally used to assume management of a socket accepted from the Daemon Control.
State Provides status information to the user interface. The State event fires to signal that this property has changed.
Timeout Controls the blocking behavior of methods that can be used in blocking and non-blocking ways.
Public Methods
Abort Abort any blocking method and release all system resources.
About Show the About Box.
ClearCertificate Clears the Certificate object contained in the Cerificate property.
Close Close the session and release all system resources. A single control can be used for many connections, one after the other.
Connect Establish a secure connection.
Fill Use this method when you know exactly how many bytes or characters you want from the TCP stream.
Receive Receive an arbitrary amount of data. The specified String or Byte array is filled with bytes from the remote host.
Search Receive data up to and including a terminating sequence.
Send Send data after a connection is established.
Trace Start or stop the accumulation of trace or debug data. Once started, this method accumulates data until it is turned off.
Public Events
Authenticate Fires when the remote host has sent a certificate to be authenticated.
Certificate Fires when the remote host is requesting a certificate and the Certificate property is not set to a valid Certificate Object.
Error Fires when an error condition occurs.
Receive Fires when ReceiveBufferCount changes.
Send Fires when the system accepts data for sending.
State Fires when the State property changes.

Code Example

How easy is the SecureTcp component to use? This example demonstrates creating a simple secure TCP client.

Private Sub SecurityTest2()
    ' Perform all checks in the Authenticate event
    SecureTcp1.Security = secureNormal

    ' Connect to a secure echo server. Security will be negotiated first.
    SecureTcp1.Connect "myserver", 7

    ' Success! SSL connection established. Send some data
    ' just to test the SSL connection
    SecureTcp1.Send ("test")

    ' Receive and print the response
    Dim Data As String
    Dim ByteCount As Long
    ByteCount = SecureTcp1.Receive(Data)    
    Debug.Print Data

    ' Close connection
End Sub

Private Sub SecureTcp1_Authenticate(ByVal RemoteCertificate As DartSecureFtpCtl.ICertificate, 
ByVal TrustedRoot As Boolean, ByVal ValidDate As Boolean, ByVal ValidSignature As Boolean, 
Valid As Boolean)
    ' The server's certificate has been received.
    Dim Msg As String

    ' Check to see if it passed all the checks.
    If Not Valid Then
        ' It didn't, so check everything and give the user the option to accept/reject.
        If Not ValidDate Then Msg = Msg + "- Certificate date is invalid" + vbCrLf
        If Not TrustedRoot Then Msg = Msg + "- Certificate Authority is not trusted" 
        + vbCrLf
        If Not ValidSignature Then Msg = Msg + "- Certificate does not contain a valid 
        signature" + vbCrLf

        Msg = "The following conditions are true:" + vbCrLf + vbCrLf + Msg + vbCrLf 
        + vbCrLf
        Msg = Msg + "Do you still wish to authenticate?"
        If MsgBox(Msg, vbYesNo + vbExclamation, "Security Alert") = vbYes Then
            ' User still wants to accept so accept it (by setting Valid to true)
            Valid = True
        End If
    End If
End Sub