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.
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.
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();
Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista
SegmentedStream Class | SegmentedStream Members | Overload List
Send comments on this topic.
Documentation version 1.0.3.0.
© 2008 Dart Communications. All rights reserved.