Click here to Skip to main content
15,886,110 members
Articles / Programming Languages / C#

LumiSoft MailServer

Rate me:
Please Sign up or sign in to vote.
3.79/5 (22 votes)
17 Nov 2006CPOL1 min read 321.8K   4.9K   74  
Full featured SMTP/POP3/IMAP server
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;

namespace LumiSoft.Net.SIP
{
    /// <summary>
    /// FIX ME: temporary class, make some global logging functionality.
    /// </summary>
    public class SipLogger
    {
        /// <summary>
        /// Default constructor.
        /// </summary>
        public SipLogger()
        {
        }

        #region method AddDebugg

        /// <summary>
        /// Logs specified debug text.
        /// </summary>
        /// <param name="text"></param>
        public void AddDebug(string text)
        {
            try{
                //System.IO.File.AppendAllText("c:\\sipX.txt",text + "\r\n");
            }
            catch{
            }
        }

        #endregion

        #region method AddSend

        /// <summary>
        /// Logs specified send.
        /// </summary>
        /// <param name="data">Data what was sent.</param>
        /// <param name="localEndPoint">Local IP end point.</param>
        /// <param name="remoteEndPoint">Remote IP end point.</param>
        public void AddSend(byte[] data,IPEndPoint localEndPoint,IPEndPoint remoteEndPoint)
        {
            try{
                string text = "Sending (" + data.Length + " bytes): " + localEndPoint.ToString() + " -> " + remoteEndPoint.ToString() + "\r\n<begin>\r\n" + System.Text.Encoding.UTF8.GetString(data) + "<end>\r\n";
                //System.IO.File.AppendAllText("c:\\sipx.txt",text);
            }
            catch{
            }
        }

        #endregion

        #region method AddReceive

        /// <summary>
        /// Logs specified receive.
        /// </summary>
        /// <param name="data">Data what was received.</param>
        /// <param name="localEndPoint">Local IP end point.</param>
        /// <param name="remoteEndPoint">Remote IP end point.</param>
        public void AddReceive(byte[] data,IPEndPoint localEndPoint,IPEndPoint remoteEndPoint)
        {
            try{
                //System.IO.File.AppendAllText("c:\\sipx.txt","Received (" + data.Length + " bytes): " + localEndPoint.ToString() + " <- " + remoteEndPoint.ToString() + "\r\n" + System.Text.Encoding.UTF8.GetString(data) + "\r\n");
            }
            catch{
            }
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Estonia Estonia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions