ImapLowLevelDataReceived Event
Occurs when data is received from the connected socket.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public event DataTransferEventHandler LowLevelDataReceived

Value

Type: MailBeeDataTransferEventHandler
Remarks

If the transmission channel is encrypted, this event will be raised when any encrypted chunk of data is received. Thus, this event can be used to record the data which is actually received from the network.

The typical use of this property is to calculate the network traffic produced during the IMAP4 session. SSL encryption increases the length of the transmitted data blocks, thus it's more accurate to calculate traffic by counting the length of data actually transmitted over the network.

If the transmission channel is not encrypted or otherwise scrambled, this property is equivalent to DataReceived.

Examples
This sample calculates all incoming traffic from the server during the IMAP4 session, and prints the result into console.
using System;
using MailBee;
using MailBee.ImapMail;
using MailBee.Mime;

class Sample
{
    // Total bytes received counter.
    private static int _totalBytes = 0;

    // LowLevelDataReceived event handler.
    private static void OnLowLevelDataReceived(object sender, DataTransferEventArgs e)
    {
        // Increment the counter.
        _totalBytes += e.Data.Length;
    }

    // The actual code.
    static void Main(string[] args)
    {
        Imap imp = new Imap();

        // Subscribe to the LowLevelDataReceived event.
        imp.LowLevelDataReceived += new DataTransferEventHandler(OnLowLevelDataReceived);

        // Do something which would produce some network traffic.
        imp.Connect("mail.domain.com");
        imp.Login("jdoe", "secret");
        imp.SelectFolder("Inbox");
        MailMessageCollection msgs = imp.DownloadMessageHeaders(Imap.AllMessages, false);
        imp.Disconnect();

        // Print the total number of bytes previously received from the server.
        Console.WriteLine(_totalBytes + " bytes received in all");
    }
}
See Also