⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 socketfactory.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace NCindy.Util
{
    using NCindy;
    using NCindy.Util.Logging;
    using System;
    using System.Net.Sockets;

    internal class SocketFactory
    {
        private static readonly ILogger log = LogFactory.CreateLogger(MethodBase.GetCurrentMethod().ReflectedType);

        public static Socket CreateSocket(SessionType sessionType)
        {
            Socket socket = null;
            switch (sessionType)
            {
                case SessionType.Tcp:
                    socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    break;

                case SessionType.Udp:
                    socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                    break;
            }
            if (log.IsDebugEnabled)
            {
                log.Debug(string.Format("Create a {0} socket.", sessionType));
            }
            return socket;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -