public ServersManager(ServersManagerConfig config) { if (BufferManager.IsInitialized() == false) { BufferManager.Initialize(256); // Mb } if (EventArgsManager.IsInitialized() == false) { EventArgsManager.Initialize(); } this.running = false; this.sync = new object(); this.protocolPorts = new List <ProtocolPort>(); this.servers = new ThreadSafeDictionary <ServerEndPoint, Server <C> >(); this.fakeServers = new ThreadSafeDictionary <ServerEndPoint, Server <C> >(); this.AddressPredicate = DefaultAddressPredicate; this.FakeAddressAction = DefaultFakeAddressAction; this.config = config; this.nextPort = config.MinPort; this.logger = new Logger(); }
public UdpServer(ServersManagerConfig config) : base() { sync = new object(); queueSize = (config.UdpQueueSize > 0) ? config.UdpQueueSize : 16; }
public BaseTcpServer(ServersManagerConfig config) { this.sync = new object(); this.receiveQueueSize = config.TcpQueueSize; this.minAcceptBacklog = config.TcpMinAcceptBacklog; this.maxAcceptBacklog = config.TcpMaxAcceptBacklog; this.socketReuseEnabled = (this.minAcceptBacklog < this.maxAcceptBacklog); }
public BaseTcpServer(ServersManagerConfig config) : base() { sync = new object(); receiveQueueSize = config.TcpQueueSize; //offsetOffset = config.TcpOffsetOffset; minAcceptBacklog = config.TcpMinAcceptBacklog; maxAcceptBacklog = config.TcpMaxAcceptBacklog; socketReuseEnabled = minAcceptBacklog < maxAcceptBacklog; }
public ServersManager(ServersManagerConfig config) { if (!BufferManager.IsInitialized()) { BufferManager.Initialize(256); } if (!EventArgsManager.IsInitialized()) { EventArgsManager.Initialize(); } this.running = false; this.sync = new object(); this.protocolPorts = new List <ProtocolPort>(); this.servers = new ThreadSafeDictionary <ServerEndPoint, Server <C> >(); this.fakeServers = new ThreadSafeDictionary <ServerEndPoint, Server <C> >(); this.AddressPredicate = new Func <NetworkInterface, IPInterfaceProperties, UnicastIPAddressInformation, bool>(ServersManager <C> .DefaultAddressPredicate); this.FakeAddressAction = new Func <ServerEndPoint, IPEndPoint>(ServersManager <C> .DefaultFakeAddressAction); this.config = config; this.nextPort = config.MinPort; this.logger = new Logger(); }
public UdpServer(ServersManagerConfig config) { this.sync = new object(); this.queueSize = ((config.UdpQueueSize > 0) ? config.UdpQueueSize : 16); }
public static Server <C> Create(ServerEndPoint real, IPEndPoint ip4fake, IPAddress ip4mask, ServersManagerConfig config) { Server <C> server; if (real.Protocol == ServerProtocol.Tcp) { server = new TcpServer <C>(config); } else if (real.Protocol == ServerProtocol.Udp) { server = new UdpServer <C>(config); } else { if (real.Protocol != ServerProtocol.Tls) { throw new InvalidOperationException("Protocol is not supported."); } server = new SspiTlsServer <C>(config); } server.realEndPoint = real.Clone(); if (ip4fake != null) { if (ip4mask == null) { throw new ArgumentNullException("ip4mask"); } server.fakeEndPoint = new ServerEndPoint(server.realEndPoint.Protocol, ip4fake); server.ip4Mask = Server <C> .GetIPv4Long(ip4mask); server.ip4Subnet = (Server <C> .GetIPv4Long(real.Address) & server.ip4Mask); } return(server); }
public TcpServer(ServersManagerConfig config) : base(config) { }
public SspiTlsServer(ServersManagerConfig config) : base(config) { this.certificate = config.TlsCertificate; }