Glossary Item Box

PowerTCP SSL Sockets for .NET

Placing Components on a Form

Although PowerTCP SSL Sockets for .NET can be used in your preferred environment on any machine that has the .NET Framework installed, the recommended method is to use the Visual Studio .NET environment.

 

To create a component within Visual Studio .NET, use the following steps (the following steps demonstrate using the Tcp component):

  1. Create a project as described in Creating A Project .
  2. Add the Tcp component to the form. To do this, right-click on the ToolBox and choose Customize ToolBox. If the ToolBox is not visible, navigate to the View menu and choose ToolBox.

  3. From the resulting dialog box, choose the .NET Framework Components tab, then scroll until you find the Tcp component (see the screen shot below). Check the checkbox next to it and select OK.

  4. Click the Tcp component icon on the ToolBox, and "drag" an instance of it onto the form. The Visual Studio .NET environment will automatically create and instantiate an instance of the Tcp component within your code.
  5. Make a quick application to test. Drag a button onto the form.
  6. Add the following code to the button "on-click" event handler.
    [C#]
    // Connect to an Echo server (typically port 7)
    tcp1.Connect("myserver", 7);
    
    // Send some data
    tcp1.Send("test");
    
    // Receive the echoed data
    Segment seg = tcp1.Receive();
    
    // In the Echo protocol, the server waits until the client closes the connection.
    tcp1.Close();
    
    // Display the data received (should be "test")
    Debug.WriteLine(seg.ToString());
    
    [Visual Basic]
    ' Connect to an Echo server (typically port 7)
    Tcp1.Connect("myserver", 7)
    
    ' Send some data
    Tcp1.Send("test")
    
    ' Receive the echoed data
    Dim seg As Segment = Tcp1.Receive()
    
    ' In the Echo protocol, the server waits until the client closes the connection.
    Tcp1.Close()
    
    ' Display the data received (should be "test")
    Debug.WriteLine(seg.ToString())
    
  7. Navigate to the Debug menu and choose Start. The application will compile and execute.

 

In This Section

Creating a Project
This topic demonstrates how to create a new Windows project in Visual Studio .NET.
Placing Components on a Form
This topic demonstrates how to create and use a control using Visual Studio .NET.
Creating Components Dynamically
This topic demonstrates how to add a component as a reference using Visual Studio .NET.
Creating Custom Dlls
Discusses the steps required when creating a dll that uses a PowerTCP control.
Using Components Outside of Visual Studio
This topic discusses the use of the components without Visual Studio.
Using Events within the Visual Studio .NET Environment
Describes how to use PowerTCP events within the Visual Studio .NET environment.
Using Events when a Component is Created Dynamically
Describes the extra steps required to use events when using a PowerTCP component as a reference.

 

 


Send comments on this topic.

Documentation version 1.1.2.0.

© 2008 Dart Communications.  All rights reserved.