/// <summary> /// Initialize a new server /// </summary> /// <param name="addr">IP address of TCP listener</param> /// <param name="port">port number of TCP listener</param> /// <param name="serverActions">Instance of server actions class</param> /// <param name="clientHandler">Instance of client handler class</param> public Server(IPAddress addr, int port, IClientHandlerFactory clientHandlerFacotry, IServerActions serverActions = null) { this.Address = addr; this.Port = port; this.clientHandlerFactory = clientHandlerFacotry; this.serverActions = serverActions; this.listener = new TcpListener(Address, Port); clients = new Dictionary<string, TcpClient>(); }
/// <summary> /// Initialize a new server /// </summary> /// <param name="port">port number of TCP listener</param> /// <param name="serverActions">Instance of server actions class</param> /// <param name="clientHandler">Instance of client handler class</param> public Server(int port, IClientHandlerFactory clientHandlerFacotry, IServerActions serverActions = null) : this(IPAddress.Loopback, port, clientHandlerFacotry, serverActions) { }