using IpcLibrary.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IpcLibrary.Server {
    /// <summary>
    /// IPC服务器工厂
    /// </summary>
    public static class IPCServerFactory {
        /// <summary>
        /// 创建默认配置的服务器
        /// </summary>
        public static IIPCServer CreateServer() {
            return new IPCServer();
        }

        /// <summary>
        /// 创建自定义配置的服务器
        /// </summary>
        public static IIPCServer CreateServer(IPCConfiguration configuration) {
            return new IPCServer(configuration);
        }

        /// <summary>
        /// 创建并启动服务器
        /// </summary>
        public static async Task<IIPCServer> CreateAndStartAsync(string address, IPCConfiguration configuration = null) {
            var server = new IPCServer(configuration);
            await server.StartAsync(address);
            return server;
        }
    }

}
