StartSender() public method

public StartSender ( ) : void
return void
示例#1
0
 /// <summary>
 /// Initialize and start the server.
 /// </summary>
 public Server(Game game, int capacity, IPAddress address)
 {
     ipAddress = address;
     IPEndPoint ep = new IPEndPoint(ipAddress, 0);
     listener = new TcpListener(ep);
     listener.Start();
     ipPort = ((IPEndPoint)listener.LocalEndpoint).Port;
     numberOfGamers = capacity;
     Gamers = new List<ServerGamer>();
     for (int i = 0; i <= capacity; i++)
     {
         ServerGamer gamer = new ServerGamer() { Game = game, OnlineStatus = Network.OnlineStatus.Offline };
         gamer.OnDisconnected += Server_OnDisconnected;
         gamer.StartSender();
         Gamers.Add(gamer);
     }
     this.game = game;
     Trace.TraceInformation("Server initialized with capacity {0}", capacity);
 }
示例#2
0
        /// <summary>
        /// Initialize and start the server.
        /// </summary>
        public Server(Game game, int capacity, IPAddress address)
        {
            ipAddress = address;
            IPEndPoint ep = new IPEndPoint(ipAddress, 0);

            listener = new TcpListener(ep);
            listener.Start();
            ipPort         = ((IPEndPoint)listener.LocalEndpoint).Port;
            numberOfGamers = capacity;
            Gamers         = new List <ServerGamer>();
            for (int i = 0; i <= capacity; i++)
            {
                ServerGamer gamer = new ServerGamer()
                {
                    Game = game, OnlineStatus = Network.OnlineStatus.Offline
                };
                gamer.OnDisconnected += Server_OnDisconnected;
                gamer.StartSender();
                Gamers.Add(gamer);
            }
            this.game = game;
            Trace.TraceInformation("Server initialized with capacity {0}", capacity);
        }