PowerTCP Sockets for .NET

from $349.00
Available Platforms

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();
    Data response = tcp1.Read(ReadBuffer);
    Console.WriteLine("Received: {0}", response.ToString());


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