PowerTCP Mail for .NET
Segment Class
Members  Example  See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace : Segment Class




Provides a reference to a data segment where data is sent or received over a TCP stream.

Object Model

Segment Class

Syntax

Visual Basic (Declaration) 
Public Class Segment 
Visual Basic (Usage)Copy Code
Dim instance As Segment
C# 
public class Segment 
Managed Extensions for C++ 
public __gc class Segment 
C++/CLI 
public ref class Segment 

Example

The following example demonstrates connecting to a server while specifying a local interface to use.
Visual BasicCopy Code
' Connect to the server, specifying the local interface to use
Tcp1.Connect("atropos", 13, "192.168.0.83", 8888)

' Since connection was to DAYTIME port (13), simply receive the time
Dim seg As Segment = Tcp1.Receive()

Debug.WriteLine("Time reported by server: " + seg.ToString())
C#Copy Code
// Connect to the server, specifying the local interface to use
tcp1.Connect("atropos", 13, "192.168.0.83", 8888);

// Since connection was to DAYTIME port (13), simply receive the time
Segment seg = tcp1.Receive();

Debug.WriteLine("Time reported by server: " + seg.ToString());

Remarks

When data is sent or received when using the Tcp component (which may be by using the Tcp component directly, or by using another component that uses the Tcp component for the underlying connection), a Segment object is returned. This Segment object will contain data such as the data sent or received and the amount of bytes sent or received. To use the data, simply access the Segment.Buffer property using the offset specified by the Segment.Offset property. As a shortcut, the Segment.ToString method can be used to simply return all data sent or received as a string.

The Segment object is also used by other components beside the Tcp component. For example, several components have a Trace event which allows access to any data sent or received over the control connection. A SegmentEventArgs class is made accessible in this event, containing a Segment object describing the data sent or received.

Inheritance Hierarchy

System.Object
   Dart.PowerTCP.Mail.Segment

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.