PowerTCP Mail for .NET
ReceiveBufferSize Property
See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Tcp Class : ReceiveBufferSize Property




Gets and sets the size of the system receive buffer.

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("Gets and Sets the size of the system receive buffer.")>
<CategoryAttribute("Socket Options")>
<DefaultValueAttribute()>
Public Property ReceiveBufferSize As Integer
Visual Basic (Usage)Copy Code
Dim instance As Tcp
Dim value As Integer
 
instance.ReceiveBufferSize = value
 
value = instance.ReceiveBufferSize
C# 
[DescriptionAttribute("Gets and Sets the size of the system receive buffer.")]
[CategoryAttribute("Socket Options")]
[DefaultValueAttribute()]
public int ReceiveBufferSize {get; set;}
Managed Extensions for C++ 
[DescriptionAttribute("Gets and Sets the size of the system receive buffer.")]
[CategoryAttribute("Socket Options")]
[DefaultValueAttribute()]
public: __property int get_ReceiveBufferSize();
public: __property void set_ReceiveBufferSize( 
   int value
);
C++/CLI 
[DescriptionAttribute("Gets and Sets the size of the system receive buffer.")]
[CategoryAttribute("Socket Options")]
[DefaultValueAttribute()]
public:
property int ReceiveBufferSize {
   int get();
   void set (    int value);
}

Property Value

Size of the system receive buffer in bytes. The default is 8192.

Example

The following example demonstrates sending and receiving data using byte arrays.
Visual BasicCopy Code
' Connect to an echo port
Tcp1.Connect("atropos", 7)

' Send some bytes
Dim buffer As Byte() = System.Text.Encoding.Default.GetBytes("test")
Tcp1.Stream.Write(buffer, 0, buffer.Length)

' Receive the echoed data
Dim response(Tcp1.ReceiveBufferSize) As Byte
Tcp1.Stream.Read(response, 0, Tcp1.ReceiveBufferSize)

' Close the connection
Tcp1.Close()

' Display the response
Debug.WriteLine(System.Text.Encoding.Default.GetString(response))
C#Copy Code
// Connect to an echo port
tcp1.Connect("atropos", 7);

// Send some bytes
byte[] buffer = System.Text.Encoding.Default.GetBytes("test");
tcp1.Stream.Write(buffer, 0, buffer.Length);

// Receive the echoed data
byte[] response = new byte[tcp1.ReceiveBufferSize];
tcp1.Stream.Read(response, 0, tcp1.ReceiveBufferSize);

// Close the connection
tcp1.Close();

// Display the response
Debug.WriteLine(System.Text.Encoding.Default.GetString(response));

Remarks

This property sets the size of the system receive buffer. The default is 8192 which means that if the total data's bytes you are receiving exceeds this you will need to call Tcp.Receive multiple times until Tcp.Connected = false.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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