PowerTCP Sockets for .NET

from $349.00
Available Platforms

Server, Tcp, Udp, Dns, Ping Components

PowerTCP Sockets for .NET is an enhanced collection of sockets controls, boasting a newly designed API that is intuitive and easy to use. The new design promotes a Model-View-Controller (MVC) application architecture, so that you may localize your protocol functions and settings to a reusable model class. This library requires fewer resources, provides greater flexibility, elicits code that is easier to re-use and maintain, and is backed by the best technical support in the industry.

  • Supports .NET 2.0 features including generics, IPv6, and X509 certificates
  • Supports .NET 4.5 Asynchronous Tasks for TCP and UDP.
  • Secure Socket Layer (SSL) security
  • Transport Layer Security (TLS)
  • Lightweight, Single Dll typically less than 5% the size of our competitors' bloated dlls
  • Powerful, scalable Server control
  • Many code examples and sample applications in C# and VB

Tcp tcp1 = new Tcp();
string host = "EchoServer";
byte[] ReadBuffer = new byte[1024];
string input = String.Empty;

tcp1.Connect(new TcpSession(new Dart.Sockets.IPEndPoint(host, 7)));

Console.WriteLine("Connected to {0} type 'exit' to quit.");

while (input.ToLowerInvariant() != "exit")
{
    input = Console.ReadLine();
    tcp1.Write(input);
    Data response = tcp1.Read(ReadBuffer);
    Console.WriteLine("Received: {0}", response.ToString());
}

Feature Overview

Feature-Rich Components
  • Stream interface enhances ease of integration
  • TLS & SSL support makes secure communications as easy as a single method call
  • SOCKS4, SOCKS5, Http proxy support included
  • Log event simplifies debugging and logging
  • New IPEndPoint class resolves IPv4 and IPv6 hostnames
  • Support for Windows applications, services, console and ASP.NET web applications
Ping, DNS and UDP
  • UDP component builds on Framework capabilities
  • MX Record look-up (for resolving mail server names) supplements native DNS class
  • Resolve host names, IPv4, and IPv6 addresses using a specified DNS server and local endpoint
  • Ping includes broadcasting capabilities
  • Ping without admin permissions
  • Trace routes to discover bottlenecks
Scalable Multithreaded Server
  • Build high-performance server apps that implement any TCP-based protocol
  • Dedicate a worker thread to each connection or make asynchronous reads using scalable IO completion threads
  • Client connections are enumerated in a convenient list
Samples and Documentation
  • Many sample projects for C# and VB.NET, including ASP.NET
  • Comprehensive MS Help 2.0 and Help Viewer integrated documentation
  • Stand-alone and online documentation
  • .NET Framework 4 Client Profile compatible
  • 64-bit OS support

Included With PowerTCP Sockets for .NET

Five components plus supporting classes
Sample projects written in C#, VB.NET, VC++/CLI
Comprehensive MS Help 2.0 and MS Help Viewer integrated documentation
Free introductory support

Component Description
Ping Component Ping hosts to determine availability.
Server Component Create scalable server applications using TCP and optionally TLS\SSL
Tcp Component Communicate with servers using TCP and optionally TLS\SSL.
Udp Component Communicate with hosts using UDP.
Dns Component Resolve host names and addresses, as well as mail hosts associated with email addresses.

 

Supported Environments

PowerTCP for .NET components and classes will operate on any Microsoft operating system that fully supports the Microsoft .NET Framework, including 64-bit Windows. .NET components are dependent on the Framework rather than a specific operating system. Products support .NET Framework versions 2.0 through 4.8 and .NET Standard 2.0 (.NET Core, .NET 5, .NET 6, .NET 7, etc.).

The components can be used with any .NET compliant language, see the list below:

Supported languages:
  • C#
  • VB.NET
  • Managed C++
  • PowerShell
Tested in the following application environments:
  • Standard Windows desktop applications
  • Console applications
  • ASP.NET web applications and Web Sites
  • Windows service applications
  • Web service applications
  • Windows .NET Framework 4 Client Profile
Tested in the following development environments:
  • Visual Studio .NET (2005, 2008, 2010, 2012, 2013, 2015, 2017, 2019, 2022)
Tested with the following proxies:
  • Ositis WinProxy 6.1 R1c
  • Handcrafted Software FreeProxy 4.10.1751
  • Fiddler2

 

 

PowerTCP for .NET components do not currently support execution within Silverlight. If you are interested in using Dart products within your Silverlight solution, contact support@dart.com for more options.

 

New Sample Projects for PowerTCP Sockets for .NET have been added to include .NET Core 2.0 projects, referencing the Dart.Ftp.Standard dll. Look for the to identify these sample

Code Examples

These code snippets can be copied and pasted into your project.

Code Snippet Description
Tcp Echo Client Demonstrates how to connect, send and receive data in a windows forms application.
Worker Thread Server Demonstrates how to write a server that dedicates a worker thread for each client.
Async Server Demonstrates how to write a server that utilizes on-demand IO completion threads.
UDP Multicast Demonstrates how to join a multicast group asynchronously, without blocking the UI.
Ping Remote Host Demonstrates how to ping a remote host asynchronously, without blocking the UI.
DNS Mail Host Lookup Demonstrates how lookup mail hosts associated with an email address asynchronously, without blocking the UI.

 

Example Projects

Samples are working applications demonstrating Sockets for .NET components in C#, VB.NET and C++/CLI. Source code included.

 

Sample Name Sample Description
DNS Client Demonstrates a client used for resolving domain names, IP addresses and mail address hosts.
Ping Client Demonstrates a client used for determining if a host is reachable
Proxy Server Implements a test proxy server that supports SSL tunneling, as well as Socks and Http proxy servers.
Server Server implements several protocols with two modes of operation ("sync" using dedicated worker threads and "async" using IO completion threads).
Server Windows Service Demonstrates a server that runs as a windows service.
Simple Server  Uses the PowerTCP Sockets Server class to demonstrate an echo server with a minimal amount of code.
TCP Client Demonstrates a client which communicates with hosts using TCP with optional proxy and SSL use.
TCP Client Console Uses the PowerTCP Sockets Tcp class to provide a functional client which can be used to connect to, communication with, and test server applications.
TCP Client Task Async Uses awaitable task methods to communicate with hosts using TCP with optional proxy and SSL use.
Trace Route Client Demonstrates a client that traces a route to any host.
UDP Chat Client Uses UDP multicasting or broadcasting to chat with other users on the network.
UDP Chat Client Task Async Uses the awaitable task methods of the UDP class to demonstrate multicasting or broadcasting to chat with other users on the network.
UDP Time Demonstrates Network Time Protocol (NTP) over UDP on both client- and server-side.
Ping Web Client Demonstrates a web page that can be used to ping other hosts.
TCP Echo Web Client Uses the Tcp component in ASP.NET to communicate with an echo server.

 

 

Product Release History for PowerTCP Sockets for .NET

The following is a list of public releases for all components shipped with PowerTCP Sockets for .NET (Latest Release 2023-3-2023)

 

PowerTCP Sockets for .NET

Current Version: 6.1.1.0

6.1.1.0 Released: 2024-11-6



Dart Communications is pleased to announce the release of PowerTCP Sockets for .NET 6.1.1.

 

Product fixes in this release:

  • A problem with licensing the component for runtime has been fixed.

 

 

6.1.0.5 Released: 2023-3-21



Dart Communications is pleased to announce the release of PowerTCP Sockets for .NET 6.1.

 

Changes in this release:

  • Licensing has been refactored. Please review documentation here.
  • Support for .NET Framework 3.5 has been dropped and a minimum of .NET Framework 4.5 is now required. (Please contact sales@dart.com if you require an assembly for a previous version of .NET Framework.)
  • Improved Visual Studio Integration.
  • Full support for .NET 7.

 

 

4.5.7.2   Released: 2020-12-16


 

Product fixes in this release:

  • Fixed a minor compatibility issue so that Dart.Sockets.Standard.dll can be used with .NET 5.0.

 

 

4.5.6.0   Released: 2019-06-17


 

Product fixes in this release:

  • Fixed an issue in the .NET Standard assembly that resulted in string resources not being available when certain exceptions occurred. (1075)
  • Fixed an issue that resulted in .NET Standard assemblies being unusable in newer .NET Core preview releases.
  • Fixed an issue that could result in a hard crash when connecting to an closed port when using ConnectTaskAsync. (1078)

 

 

4.5.4.0    Released: 2018-04-30

 

    • Added support for .NET Standard 2.0 and .NET Core 2.0
    • New .NET Core 2.0 sample projects, referencing the Dart.Sockets.Standard dll
    • Updated trial license operation for use on .NET Standard-compatible platforms
      • Details regarding trial operation for Dart.Sockets.Standard.dll can be found in the Licensing and Trial Operation topic in the included help documentation

     

    4.5.3.0   Released: 2017-03-08


     

    • Visual Studio 2017 compatibility.

     

     

    4.5.2.0 Released: 2016-10-18


     

    Product fixes in this release:

    • An issue where requesting less bytes than what is available when reading asynchronously and using ssl could potentially result in hangs until another socket operation is performed has been resolved. (692)
    • ClientSecurity.TargetHost will now use Session.RemoteEndPoint.HostNameOrAddress if TargetHost is not populated per current documentation. (712)
    • IPv6 Ping reply addresses are now reported correctly. (950)

     

     

    4.5.1.1   Released: 2014-12-05


     

    Product fixes in this release:

    • An issue where the server component would intermittently fail to post another pending accept if a failure occurred during a previous accept has been resolved. (593)

     

     

    4.5.0.1   Released: 2014-06-05


     

    • Support for IPV6 address resolution added to the DNS component.
    • Added awaitable read, write, and connect method overloads to the TCP and UDP classes. Developers must use the Dart.Sockets.45 dll in order to take advantage of this functionality.
    • Added a ConnectTimeout property to the TCP Session class to provide a time out for pending connections.
    • Improved support for CAS level 2 applications in medium trust environments.

     

     

    4.4.4.8   Released: 2012-10-26


     

    • PowerTCP Sockets for .NET has been updated for Visual Studio 2012 integration and Windows 8 compatibility.
    • Trial licensing operation updated.
    • Changed serialization to use simple partial name serialization to improve cross-version compatibility.

     

    Product fixes in this release:

    • A more informative exception is now thrown when AuthenticateAsServer is called and the connection is aborted before authentication can succeed. (5411)
    • Addressed a globalization issue that prevented correct operation for systems using the following language cultures: Azeri (az), Azeri-Latin (az-Latn), Azeri-Latin-Azerbaijan (az-Latn-AZ), Turkish (tr), Turkish-Turkey (tr-TR). (TFS31)

     

     

    4.4.3.1   Released: 2012-07-12


     

    Product fixes in this release:
    Fixed a licensing issue with web service applications.
    Updated the title bar of licensing messages to not indicate a product is in trial when it is licensed.

     

     

    4.4.2.0   Released: 2012-06-27


     

    • Updated trial operation behavior and removed obstacle to using product in .NET Framework 4.5.

     

     

    4.4.1.3   Released: 2012-04-24


     

    Product fixes in this release:

    • Fixed memory leak in Server component. (5595)

     

     

    4.4.0.3   Released: 2011-03-03


     

    • The Mx Class has been replaced with a Dns component. In addition to performing Mx record lookups, the component performs domain name and IP address lookups. Features include the ability to specify the local endpoint to bind to, as well as the DNS server to use.
    • Many custom Start delegates such as TcpThreadStart and UdpThreadStart have been replaced with the .NET Framework standard WaitCallback delegate. This generally means that callback functions no longer include the calling component as a parameter (this is true even for custom delegates that were not replaced).
    • The Connect method was updated to take the new TcpSession object as a parameter. TcpSession is a serializable object that facilitates the saving of session settings.
    • The AuthenticateAsClient and AuthenticateAsServer methods were updated to take the new ClientSecurity and ServerSecurity objects as parameters, respectively. These two objects are serializable, facilitating the saving of security sessions.
    • The ReadToX functions (ReadtoDelimiter, ReadToCount, ReadToEnd) were updated to throw the new DataException when an error condition occurs. DataException includes a DataRead field which provides the data read prior to the exception.
    • Several samples were updated with "model" classes, to fall more in line with the Model-View-Controller (MVC) design philosophy. For more on MVC, see the "MVC Design in Applications" page of the help file.

     

    Product fixes in this release:

    • Addressed a memory leak with the ReceiveAsync call. (5396)
    • The ConnectionStateChanged event and the ConnectionState property now indicate a closed state when the remote host forcibly closes a connection. (5401)
    • Tcp.Close no longer causes a ConnectionReset exception. (5406)

     

     

    4.3.0.6   Released: 2011-01-07


     

    Dart Communications is pleased to announce the release of PowerTCP Sockets for .NET 4.3. Some of the features include:

    • Model-View-Controller design uses fewer resources, is more flexible, and produces code that is easier to maintain
    • Improved Use of .NET Features including generics and IPv6
    • SSL support for secure communications
    • SOCKS4, SOCKS5, HttpConnect proxy with design editor support
    • Multithreaded Server component for sophisticated server apps using any TCP-based protocol
    • Dedicate a worker thread to each connection, or
    • Use asynchronous read calls utilizing IO completion threads
    • UDP builds on inherent Framework capabilities
    • Perform MX Record look-ups
    • Ping includes a broadcasting option
    • Ping without the need of admin permissions using system dlls
    • Trace routes to discover bottlenecks
    • Support for Windows applications, services and ASP.NET web applications
    • Many sample projects for C#, VB.NET, C++/CLI, including ASP.NET
    • Comprehensive MS Help 2.0 and Help Viewer 1.0 integrated documentation
    • Stand-alone and online documentation also provided
    • NET Framework 4 Client Profile compatible
    • 64-bit OS support

     

    No more Async methods

    Previous versions of PowerTCP and PowerSNMP implemented an event-driven model for asynchronous use. In addition to a synchronous method, each operation had an asynchronous "BeginXXX" method and corresponding "EndXXX" event. For example, to receive data asynchronously using the Tcp component, the developer called BeginReceive and waited for the EndReceive event to fire with data. In the meantime, other code was free to execute.

    In the new model, asynchronous methods have been eliminated. Instead, the developer uses one or more synchronous methods (for example, "Receive") within a straight blocking function, and then passes a delegate referring to this function to the component's Start method. The Start method then executes the function on its own worker thread.

     

    Marshaling data back to the UI thread
    It is often necessary to pass information from a worker thread to an element on the UI thread. The new model includes Marshal functions to simplify these cross-thread operations. Each Marshal overload corresponds to an event handler that executes on the UI thread and provides access to data passed using the Marshal method.

     

    No more "pseudo-blocking"
    Methods in the new model are now true-blocking calls. In previous versions, methods were "pseudo-blocking," meaning that events could be raised while the call blocked. With the new model, the UI is blocked if a method is called from within the UI thread. The Start method should therefore be used in UI environments so that events are raised.

     

    Slaves
    Some components, such as Ping, make use of child Slave objects to perform blocking operations. The parent component defines events and includes properties that apply to all slaves.

     

    Use of IPEndPoints
    Many methods in the current model include overloads that take IPEndPoint parameters, to facilitate IPv6 use. A new IPEndPoint derived class provides several overloads for easy IPEndPoint creation, including automatic hostname resolution.

     

     

    1.1.1.0   Released: 2008-01-30


     

    Product fixes in this release:

    • Fixed problem with CryptDecrypt sample.

     

     

    1.1.0.3   Released: 2008-01-16


     

    • New Tcp.WaitFor method for continuous receiving of data until a token string (or one of several token strings) is found.
    • New Dns.Servers collection for specifying multiple possible DNS servers to try.
    • Sockets now supports 64 bit environments.
    • Ping and TraceRoute now offer greater time precision.
    • An Abort method has been added to Ping.
    • Server.Listen has a new overload with an IPEndPoint parameter.

     

    Product fixes in this release:

    • SegmentedStream.Read overloads with a "found" parameter now have EndRead method counterparts for examining the value of "found." (2931)
    • The connection is no longer aborted in VS.NET 2005 after a Receive timeout. (4146)
    • Ping results no longer contain an extra 40 bytes of null data. (4232)

    PowerTCP Sockets for .NET Downloads

    for .NET Standard 2.0 (supported implementations can be found here) .NET Framework 4.5-4.8

     


     

    Download Windows Installer (product distribution; includes sample projects)

     

     

    Download Sample projects (only)

     

    NuGet

    1. Add a NuGet Reference to your project.
    2. Open a command line prompt.
    3. Install the Dart License tool (.NET 6.0 required): dotnet tool install -g dotnet-dartlicense
    4. Run the Dart License tool and follow the on screen prompts to activate a trial.
    PowerTCP Sockets for .NET features

     

    PowerTCP Sockets for .NET Ping Component

    Use the Ping component to integrate Ping functionality into any .NET application. Easily check if a host is reachable by sending and receiving ICMP packets. Features include:

     

    • Easy-to-use GetEchoes method sends a ping to a host
    • Specify optional data, sequence number, and TTL
    • Start method provides easy to implement operation on a worker thread
    • Send many requests simultaneously using multiple instances of the PingSlave class
    • Trace routes; responses include data for each hop
    • Includes "Type.System" option which does not require permission to utilize raw sockets
    • Includes option to broadcast pings using raw sockets
    • Marshal methods handle data marshaling to the UI thread
    • Integrates with versions 2005, 2008, 2010 and 2012 of Visual Studio
    • Supports C#, VB.NET, C++/CLI, ASP.NET and other .NET compliant development environments
    • Includes a royalty-free license!
     

    Return to Overview

    PowerTCP Sockets for .NET features

     

    PowerTCP Sockets for .NET Server Component

    Use the Server component to quickly build any custom TCP server application. Features include:

     

    • Easily build a server implementing TCP-based protocols such as FTP, SMTP, POP, etc
    • Write a custom protocol server
    • Stream interface enables advanced read/write capabilities such as reading to a delimiter
    • SSL support for secure communication
    • Dedicate a worker thread for each connection for streamlined, state-less code
    • Alternatively use asynchronous read calls for a high performance server utilizing IO completion threads
    • Log event exposes data sent and received for easy debugging and logging
    • Support for popular proxies, including Socks and HttpConnect
    • Underlying properties of utilized sockets exposed
    • Integrates with versions 2005, 2008, 2010 and 2012 of Visual Studio
    • Supports C#, VB.NET, C++/CLI, ASP.NET and other .NET compliant development environments
    • Includes a royalty-free license!

     

    Return to Overview

    PowerTCP Sockets for .NET features

     

    PowerTCP Sockets for .NET Tcp Component

    Use the Tcp component to communicate with any host using TCP (Transmission Control Protocol). Features include:

     

    • Stream interface enables advanced read/write capabilities such as reading to a delimiter
    • SSL support for secure communication
    • Log event exposes data sent and received for easy debugging and logging
    • Start method provides easy to implement operation on a worker thread
    • Asynchronous socket reads also supported
    • Marshal methods handle data marshaling to the UI thread
    • Support for popular proxies, including Socks and HttpConnect
    • PTY property binds a TextBox to the component as a ready-made interface for interactive online communications
    • Underlying properties of the utilized socket exposed
    • Provides asynchronous awaitable connect, read, write, and authenticate operations.
    • Integrates with versions 2005, 2008, 2010 and 2012 of Visual Studio
    • Supports C#, VB.NET, C++/CLI, ASP.NET and other .NET compliant development environments
    • Includes a royalty-free license!

     

    Return to Overview

    PowerTCP Sockets for .NET features

     

    PowerTCP Sockets for .NET Udp Component

    Use the Udp component within the .NET Framework to send and receive user datagrams. Features include:

     

    • Simple, intuitive Send and Receive methods handle all communication
    • JoinMulticastGroup and LeaveMulticastGroup makes managing multicasting easy
    • Start method provides easy to implement operation on a worker thread
    • Marshal methods handle data marshaling to the UI thread
    • Underlying properties of the utilized socket exposed
    • Provides asynchronous awaitable read and write operations.
    • Integrates with versions 2005, 2008, 2010 and 2012 of Visual Studio
    • Supports C#, VB.NET, C++/CLI, ASP.NET and other .NET compliant development environments
    • Includes a royalty-free license!

     

    Return to Overview

    PowerTCP Sockets for .NET features

     

    PowerTCP Sockets for .NET Dns Component

    Use the Dns component to integrate domain name resolution functionality into any .NET application, allowing your application to easily resolve domain names, host addresses, and email addresses. Features include:

     

    • The Dns component bypasses Winsock system services, so you can query ANY Domain Name Server on the Internet.
    • Resolves a host name to a dot address (forward lookup) and resolves a dot address to a host name (reverse lookup).
    • Resolves an email address to the mail server(s) responsible for the email address. Not supported in the .NET Framework!
    • Supports IPv6.
    • Permits selection of the local address to bind to.
    • C# and VB.NET sample projects included.
    • Includes a royalty-free license!

     

    Return to Overview

    TCP Echo Client Code Example

    See all PowerTCP Sockets for .NET Samples and Code Examples

     

    The following example demonstrates a simple TCP session in a console environment. The client sends data to an echo server and receives it back.

     

    Tcp tcp1 = new Tcp();
    string host = "EchoServer";
    byte[] ReadBuffer = new byte[1024];
    string input = String.Empty;

    tcp1.Connect(new TcpSession(new Dart.Sockets.IPEndPoint(host, 7)));

    Console.WriteLine("Connected to {0} type 'exit' to quit.");

    while (input.ToLowerInvariant() != "exit")
    {
        input = Console.ReadLine();
        tcp1.Write(input);
        Data response = tcp1.Read(ReadBuffer);
        Console.WriteLine("Received: {0}", response.ToString());
    }

     

    To download a trial please visit the PowerTCP Sockets for .NET product page.

    Worker Thread Server Code Example

    See all PowerTCP Sockets for .NET Samples and Code Examples

     

    The following example demonstrates an Echo Server in a console environment. Each client is processed on a dedicated worker thread.

     

    static void Main(string[] args)
    {
         Server server1 = new Server();

         //Start the echo server on port 7.
         //Each client is processed on its own worker thread.
         server1.Start(new ConnectThreadStart(acceptConnection), 7, null);

         Console.WriteLine("Server started. Press <Enter> to stop.");
         Console.ReadLine();
         server1.Close();
    }

    static void acceptConnection(TcpBase connection, object state)
    {
         //While connection is open, echo data received back to the client.
         //This function executes on a worker thread.
         byte[] buffer = new byte[1024];
         do
         {
             Data data = connection.Read(buffer);
             if (data != null)
             connection.Write(data.Buffer, data.Offset, data.Count);
         } while (connection.State == Dart.Sockets.ConnectionState.Connected);
    }

     

    To download a trial please visit the PowerTCP Sockets for .NET product page.

    Async Server Code Example

    See all PowerTCP Sockets for .NET Samples and Code Examples

    The following C# example demonstrates an Async Echo Server in a console environment. The server uses on-demand IO completion threads to handle clients.

      static void Main(string[] args)
    {
        Server server1 = new Server();

        //Start the echo server on port 7.
        //Each client is processed on its own worker thread.
        server1.Start(new ConnectThreadStart(acceptConnection), 7, null);

        Console.WriteLine("Server started. Press <enter> to stop.");
        Console.ReadLine();
        server1.Close();
    }

    static void acceptConnection(TcpBase connection, object state)
    {
        //While connection is open, echo data received back to the client.
        //This function executes on a worker thread.
        byte[] buffer = new byte[1024];
        do
        {
            Data data = connection.Read(buffer);
            if (data != null)
                connection.Write(data.Buffer, data.Offset, data.Count);
        } while (connection.State == Dart.Sockets.ConnectionState.Connected);
    }

     

    To download a trial please visit the PowerTCP Sockets for .NET product page.

    UDP Multicast Code Example

    See all PowerTCP Sockets for .NET Samples and Code Examples

     

    The following C# example demonstrates a UDP session in a console environment. The app joins a multicast group, sends a message, receives a response and leaves.

     

    Udp udp1 = new Udp();
    string groupEpAddress = "234.5.6.7";
    int groupEpPort = 59877;
    string message = "hello world";

    Dart.Sockets.IPEndPoint groupEp = new Dart.Sockets.IPEndPoint(groupEpAddress, groupEpPort);

    //Join Multicast group.
    udp1.Open(groupEp.Port);
    udp1.JoinMulticastGroup(groupEp.Address);

    //Send message.
    Console.WriteLine("Sending: {0}", message);
    udp1.Send(message, groupEp);

    //Receive response.
    byte[] buffer = new byte[1024];
    Datagram response = udp1.Receive(buffer);

    //Leave group.
    udp1.LeaveMulticastGroup(groupEp.Address);

    Console.WriteLine("Received: {0}", response.ToString());
    Console.WriteLine("Press <Enter> to exit.");
    Console.ReadLine(); 

    To download a trial please visit the PowerTCP Sockets for .NET product page.

    Ping Code Example

    See all PowerTCP Sockets for .NET Samples and Code Examples

     

    The following C# example demonstrates a ping operation in a console environment.

     

    PingSlave pingSlave1 = new PingSlave(System.Net.IPAddress.Any, Ping.Type.System);
    string pingTarget = "www.dart.com";

    //Ping the target with no optional data, a 20 second hop TTL and a 5 second timeout.
    Echo[] echoes = pingSlave1.GetEchoes(new Dart.Sockets.IPEndPoint(pingTarget, 0).Address, null, 20, 5000, false);

    //This event is raised when a GetEchoes result is passed to the UI.
    string results = "The following echoes were returned:\r\n";
    for (int i = 0; i < echoes.Length; i++)
        results += echoes[i].ToString() + "\r\n";
    Console.WriteLine(results);

    Console.WriteLine("Press <enter> to exit.");
    Console.ReadLine(); 

    To download a trial please visit the PowerTCP Sockets for .NET product page.

    DNS MX Lookup C# Code Example

    See all PowerTCP Sockets for .NET Samples and Code Examples

     

    The following C# example demonstrates an MX Lookup DNS operation in a Console environment. The application retrieves mail hosts for a specified email address.

     

    Dns dns1 = new Dns();
    DnsSlave dnsSlave1 = new DnsSlave(dns1, new IPEndPoint(System.Net.IPAddress.Any, 0));
    string address = "support@dart.com";

    //Add a DNS server for name resolution.
    dns1.Servers.Add(new IPEndPoint("8.8.8.8"));

    //Lookup mail servers associated with the passed in address.
    MxHostEntry[] servers = dnsSlave1.GetMxHostEntries(address, dns1.Servers[0]);

    //Build a string from the results and and display it.
    string results = "The following mail servers were returned:\r\n";
    for (int i = 0; i < servers.Length; i++)
        results += servers[i].HostName + " (" + servers[i].Preference.ToString() + ")\r\n";

    Console.WriteLine(results);
    Console.WriteLine("Press <enter> to exit.");
    Console.ReadLine();

     

    To download a trial please visit the PowerTCP Sockets for .NET product page.

    Purchase Options

    Customize your product and support options match your needs. Discounts are applied when products are purchased in multiples or within available product suites.

    $0.00 discount
     
    $499.00

    Have any questions about purchasing? See our Sales FAQ