Version: 1.1.1.0
Create multi-threaded servers and powerful Internet applications in .NET.
That all the data sent and received between the client and the server is visible in a Trace event?
The Trace event is a handy tool for debugging applications. It will fire whenever the component sends or receives data, and is perfect for adding logging capabilities to your application.
Code Sample:
private void myComponent_Trace(object sender, SegmentEventArgs e) 
{ 
    // Append data to a file
    System.IO.FileStream file = new System.IO.FileStream("c:\\Test\\log.txt", System.IO.FileMode.Append); 
    file.Write(e.Segment.Buffer, 0, e.Segment.Count); 
    file.Close(); 
}
Back to Top
That every connection to the Server component is on a separate thread?
Each connection is handled by a Tcp object executing on its own thread, allowing the construction of truly multi-threaded server applications.
Code Sample:
private void button1_Click(object sender, System.EventArgs e)
{
    //When the button is pressed
    //Start starts listening on port 7 (default for an echo server)
    server1.Listen(7);
}

private void server1_Connection(object sender, ConnectionEventArgs e)
{
    //Execution of a very simple echo server
    //This loop is performed on its own worker thread, 
    //so the server can handle many connections
    Segment receivedData = e.Tcp.Receive();
    while (e.Tcp.Connected)
    {
        e.Tcp.Send(receivedData.ToString());
        receivedData = e.Tcp.Receive();
    }
}
Back to Top
That the Tcp component can easily read data from a server until a delimiter is found?
An enhanced Tcp.Stream object is exposed on the component, providing higher level streaming capabilities such as searching for a delimiter.
Code Sample:
//Connect to a POP server, and examine its greeting message
tcp1.Connect("mail", 110); //POP servers use port 110
tcp1.ReceiveTimeout = 10000;

//Read the first 1024 bytes returned, stopping when a CRLF is found
//The Tcp.Stream property provides this capability
bool found = false;
string greeting = tcp1.Stream.Read("\r\n", 1024, ref found);
tcp1.Close();
			
if (found == true)
    MessageBox.Show(greeting);
else
    MessageBox.Show("No greeting was found");
Back to Top
That the Ping component can not only use the standard ICMP protocol for pinging other computers, but also TCP and UDP?
By simply setting the PingType property, a ping can be tried using ICMP, TCP, or UDP.
Code Sample:
//Try pinging a site using Tcp protocol
ping1.PingType = PingType.TCP;
EchoResult result = ping1.Send("www.dart.com");
MessageBox.Show(result.ToString());
Back to Top