See Also

SegmentedStream Class  | SegmentedStream Members  | Overload List

Requirements

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

Language

Visual Basic

C#

C++

C++/CLI

Show All

stream
The source stream to Read/Write.
encoding
The encoding type to use when working with strings.
See Also Languages PowerTCP Email Validation for .NET

SegmentedStream Constructor(Stream,Encoding)

Dart.PowerTCP.EmailValidation Namespace > SegmentedStream Class > SegmentedStream Constructor : SegmentedStream Constructor(Stream,Encoding)

Initializes a new instance of the SegmentedStream class for the specified stream object.

[Visual Basic]
Public Function New( _    ByVal stream As Stream, _    ByVal encoding As Encoding _ )
[C#]
public SegmentedStream(    Stream stream,    Encoding encoding );
[C++]
public: SegmentedStream(    Stream* stream,    Encoding* encoding )
[C++/CLI]
public: SegmentedStream(    Stream^ stream,    Encoding^ encoding )

Parameters

stream
The source stream to Read/Write.
encoding
The encoding type to use when working with strings.

Remarks

Although any type of stream can be used to initialize a SegmentedStream (a FileStream or a MemoryStream, for example) the intended use is to initialize a SegmentedStream with some form of network stream (such as a TcpStream). You will not usually need to create a SegmentedStream object, as the SegmentedStream object currently accessing the TCP stream is made accessible (either as a property of the component, or as an object accessible in an event or returned from a method). For example, if you wish to send/receive data to/from a server using a stream interface, simply use Tcp.Connect to connect to the server and call Tcp.Stream.Write or Tcp.Stream.Read to send/receive data.

Example

The following example demonstrates initializing a new instance of a SegmentedStream object to a TcpStream.

[Visual Basic] 

' Connect to a server
Tcp1.Connect("atropos", 7)

' Initialize a SegmentedStream to the NetworkStream
Dim sstream As New SegmentedStream(new TcpStream(Tcp1))

' Send data
sstream.Write("hello")

' Receive data
Dim s As String = sstream.Read()

[C#] 


// Connect to a server
tcp1.Connect("atropos", 7);

// Initialize a SegmentedStream to the NetworkStream
SegmentedStream sstream = new SegmentedStream(new TcpStream(tcp1));

// Send data
sstream.Write("hello");

// Receive data
string s = sstream.Read();
                

Requirements

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

See Also

SegmentedStream Class  | SegmentedStream Members  | Overload List


Send comments on this topic.

Documentation version 1.0.3.0.

© 2008 Dart Communications.  All rights reserved.