void Connected(IAsyncResult iar) { ServerPort sp = iar.AsyncState as ServerPort; TcpClient client = sp.listener.EndAcceptTcpClient(iar); FantasyFighterPlayer player; FantasyServer.fighters.AddLast(player = new FantasyFighterPlayer(form.AddEvent, client)); FantasyServer.lobby_fighters.AddLast(player); form.AddEvent("New player connected..."); listener.BeginAcceptTcpClient(Connected, this); }
private void button1_Click(object sender, EventArgs e) { server = new ServerPort(this); server.Start(); }