SocketWrench .NET Edition

SocketWrench.Initialize Method (String)

Initialize an instance of the SocketWrench class.

[Visual Basic]
Overloads Public Function Initialize( _
   ByVal licenseKey As String _
) As Boolean
[C#]
public bool Initialize(
   string licenseKey
);

Return Value

A boolean value which specifies if the class was initialized successfully.

Remarks

The Initialize method can be used to explicitly initialize an instance of the SocketWrench class, loading the networking library and allocating resources for the current thread. Typically an application would define the license key as a custom attribute, however this method can be used to initialize the class directly.

The runtime license key for your copy of SocketWrench can be generated using the License Manager utility that is included with the product. Note that if you have installed an evaluation license, you will not have a runtime license key and cannot redistribute any applications which use the SocketWrench class.

Example

The following example shows how to use the Initialize method to initialize an instance of the class. This example assumes that the license key string has been defined in code.

[CS]
SocketTools.SocketWrench socket = new SocketTools.SocketWrench();
 
if (socket.Initialize(strLicenseKey) == false)
{
    MessageBox.Show(socket.LastErrorString, "Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    return;
}
    
[Visual Basic]
Dim Socket As New SocketTools.SocketWrench
 
If Socket.Initialize(strLicenseKey) = False Then
    MsgBox(Socket.LastErrorString, vbIconExclamation)
    Exit Sub
End If
    

See Also

SocketWrench Class | SocketTools Namespace | SocketWrench.Initialize Overload List | RuntimeLicenseAttribute Class | Uninitialize Method