示例#1
0
    public override void Awake()
    {
        base.Awake();

        _receiver  = GetComponent <ServerReceiver>();
        _messenger = GetComponent <ServerMessenger>();
    }
示例#2
0
 /// <summary>
 /// Creates a new <see cref="Server{T}"/> using <see cref="Server.ServerConfiguration"/>.
 /// </summary>
 /// <param name="configuration">The <see cref="Server.ServerConfiguration"/>.</param>
 public Server(ServerConfiguration configuration)
 {
     this.ServerConfiguration = configuration ?? throw new ArgumentNullException("Configuration can't be null.");
     this.clients             = new ConcurrentDictionary <Guid, T>();
     this.acceptor            = new ServerAcceptor <T>(this);
     this.receiver            = new ServerReceiver(this);
     this.sender        = new ServerSender();
     this.bufferManager = new BufferManager(configuration.MaximumNumberOfConnections, configuration.ClientBufferSize);
 }
示例#3
0
        public ServerClient(TcpClient newTcpClient, Server server)
        {
            this.tcpClient = newTcpClient;
            this.server    = server;
            this.receiver  = new ServerReceiver(server, this);

            this.stream = tcpClient.GetStream();
            stream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnRead), null);
        }
 public CommunicatorServer(int port)
 {
     this.port = port;
     console   = new ServerReceiver(this);
 }