コード例 #1
0
 void CliManagement_ClientConnected(Client client)
 {
     ListViewItem item = new ListViewItem();
     item.Text = client.ClientID;
     item.SubItems.Add(client.SocketClient.Client.RemoteEndPoint.ToString());
     item.SubItems.Add(client.SocketClient.Client.LocalEndPoint.ToString());
     ClientslistView.Items.Add(item);
 }
コード例 #2
0
 void CliManagement_ClientConnectionEnded(Client sender)
 {
     for (int i = 0; i < ClientslistView.Items.Count; i++)
     {
         if (ClientslistView.Items[i].Text == sender.ClientID)
         {
             ClientslistView.Items[i].Remove();
             break;
         }
     }
 }
コード例 #3
0
 protected virtual void OnClientConnected(Client cli)
 {
     if (ClientConnected != null)
         ClientConnected(this, cli);
 }
コード例 #4
0
        public void addClient(Client client)
        {
            if (ConexionState)
            {
                WriteLine("Client \"" + client.ClientID + "\" connected!");

                client.ClientMessageReceived += new Client.ClientMessageReceivedEventHandler(client_ClientMessageReceived);
                client.ClientEndedConnection += new Client.ClientConnectionEndedEventHandler(client_ClientEndedConnection);

                if (!client.Cli_Listener.isRunning())
                    client.Cli_Listener.StartListeningClient();

                Client_List.Add(client.ClientID, client);
            }
            else
            {
                client.CloseConnection();
            }
        }
コード例 #5
0
 void ServListener_ClientConnected(ServeurListener sender, Client cli)
 {
     OnClientConnected(cli);
     addClient(cli);
 }
コード例 #6
0
 void client_ClientMessageReceived(Client sender, NetMessage cliMsg)
 {
     WriteLine(sender.ClientID + " : posX->" + cliMsg.PosX.ToString() + ", posY->" + cliMsg.PosY.ToString());
     OnClientMessageReceived(sender, cliMsg);
 }
コード例 #7
0
 void client_ClientEndedConnection(Client sender)
 {
     OnClientConnectionEnded(sender);
     WriteLine(sender.ClientID + " disconnected!");
     delClient(sender);
 }
コード例 #8
0
 protected virtual void OnClientMessageReceived(Client sender, NetMessage cliMsg)
 {
     if (ClientMessageReceived != null)
         ClientMessageReceived(sender, cliMsg);
 }
コード例 #9
0
 protected virtual void OnClientConnectionEnded(Client sender)
 {
     if (ClientConnectionEnded != null)
         ClientConnectionEnded(sender);
 }
コード例 #10
0
 protected virtual void OnClientConnected(Client client)
 {
     if (ClientConnected != null)
         ClientConnected(client);
 }
コード例 #11
0
 public void delClient(Client cli)
 {
     lock (locker)
     {
         if (Client_List.ContainsKey(cli.ClientID))
             Client_List.Remove(cli.ClientID);
     }
 }
コード例 #12
0
 public void BroadcastMessage(String msg, Client ClientToExclude)
 {
     lock (locker)
     {
         foreach (Client cli in Client_List.Values)
         {
             if (cli.ClientID != ClientToExclude.ClientID)
                 cli.Cli_Sender.SendMessage(msg);
         }
     }
 }