See Also

SegmentedStream Members  | Dart.PowerTCP.EmailValidation Namespace

Requirements

Namespace: Dart.PowerTCP.EmailValidation

Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista

Assembly: Dart.PowerTCP.EmailValidation (in Dart.PowerTCP.EmailValidation.dll)

Language

Visual Basic

C#

C++

C++/CLI

Show All

See Also Requirements Languages PowerTCP Email Validation for .NET

SegmentedStream Class

Dart.PowerTCP.EmailValidation Namespace : SegmentedStream Class

Used to provide advanced reading/writing capabilities to Stream-based objects.

For a list of all members of this type, see SegmentedStream members.

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.IO.Stream
         Dart.PowerTCP.EmailValidation.EnhancedStream
            Dart.PowerTCP.EmailValidation.PipeStream
               Dart.PowerTCP.EmailValidation.SegmentedStream

Syntax

[Visual Basic]
Public Class SegmentedStream    Inherits PipeStream
[C#]
public class SegmentedStream : PipeStream
[C++]
public __gc class SegmentedStream : public PipeStream
[C++/CLI]
public ref class SegmentedStream : public PipeStream

Remarks

SegmentedStream provides a way to read/write a segment of bytes to/from a backing store. To improve performance, SegmentedStream buffers reads and writes to the underlying stream and provides asynchronous read and write capability.

The SegmentedStream object is used within PowerTCP to read/write network data. The following examples further illustrate how SegmentedStream is used:

Example

The following example demonstrates connecting implementing the SMTP protocol using the Tcp component's stream interface to send a simple message.

[Visual Basic] 

' The following code assumes that good responses are always received from
' the server. More robust code should check each response and handle appropriately.

' Connect to SMTP port
Tcp1.Connect("mail", 25)

' Send the EHLO command
Tcp1.Stream.Write("EHLO myserver\r\n")

' Get response from the server
Dim s As String = Tcp1.Stream.Read()

' Send MAIL FROM command
Tcp1.Stream.Write("MAIL FROM: test@dart.com" + vbCrLf)

' Get response from the server
s = Tcp1.Stream.Read()

' Send RCPT TO command
Tcp1.Stream.Write("RCPT TO: cranford@dart.com" + vbCrLf)

' Get response from the server
s = Tcp1.Stream.Read()

' Send DATA command
Tcp1.Stream.Write("DATA" + vbCrLf)

' Get response from the server
s = Tcp1.Stream.Read()

' Send DATA
Tcp1.Stream.Write("Test Message" + vbCrLf + "." + vbCrLf)

' Receive response from the server
s = Tcp1.Stream.Read()

' Write output
Debug.WriteLine("Operation complete. The following information")
Debug.WriteLine("was reported by the server:")
Debug.WriteLine(s)

[C#] 


// The following code assumes that good responses are always received from
// the server. More robust code should check each response and handle appropriately.

// Connect to SMTP port
tcp1.Connect("mail", 25);

// Send the EHLO command
tcp1.Stream.Write("EHLO myserver\r\n");

// Get response from the server
string s = tcp1.Stream.Read();

// Send MAIL FROM command
tcp1.Stream.Write("MAIL FROM: test@dart.com\r\n");

// Get response from the server
s = tcp1.Stream.Read();

// Send RCPT TO command
tcp1.Stream.Write("RCPT TO: cranford@dart.com\r\n");

// Get response from the server
s = tcp1.Stream.Read();

// Send DATA command
tcp1.Stream.Write("DATA\r\n");

// Get response from the server
s = tcp1.Stream.Read();

// Send DATA
tcp1.Stream.Write("Test Message\r\n.\r\n");

// Receive response from the server
s = tcp1.Stream.Read();

// Write output
Debug.WriteLine("Operation complete. The following information");
Debug.WriteLine(
"was reported by the server:");
Debug.WriteLine(s);
                

Requirements

Namespace: Dart.PowerTCP.EmailValidation

Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista

Assembly: Dart.PowerTCP.EmailValidation (in Dart.PowerTCP.EmailValidation.dll)

See Also

SegmentedStream Members  | Dart.PowerTCP.EmailValidation Namespace

 

Send comments on this topic.

Documentation version 1.0.3.0.

© 2008 Dart Communications.  All rights reserved.