悲剧呀,</summary>后面多了一个尖括号……
nnhy 编写于 2012-03-30 11:00:56
X
using System;
using System.Text;
using System.Threading;
using NewLife.Net.Sockets;

namespace NewLife.Net.Application
{
    /// <summary>Daytime服务器。返回服务端的时间日期</summary>
    public class DaytimeServer : NetServer
    {
        /// <summary>实例化一个Daytime服务</summary>
        public DaytimeServer()
        {
            // 默认13端口
            Port = 13;

            Name = "Daytime服务";
        }

        /// <summary>已重载。</summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void OnAccepted(object sender, NetEventArgs e)
        {
            var session = e.Session;
            //try
            //{
            WriteLog("Daytime {0}", session.RemoteUri);

            base.OnAccepted(sender, e);

            Byte[] buffer = Encoding.ASCII.GetBytes(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff"));
            //Send(e.Socket, buffer, 0, buffer.Length, e.RemoteEndPoint);
            //session.Send(buffer, 0, buffer.Length, e.RemoteEndPoint);
            session.Send(buffer);

            //    // 等一秒,等客户端接收数据
            //    Thread.Sleep(1000);
            //}
            //finally
            //{
            //    //session.Disconnect();
            //    session.Dispose();
            //}
        }
    }
}