Example #1
0
 public void broadcast(Data d)
 {
     foreach (ClientInfo clientInfo in clientList)
     {
             byte[] message = new byte[1024];
             message.Initialize();
             d.ToByte().CopyTo(message, 0);
             clientInfo.socket.BeginSend(message, 0, message.Length, SocketFlags.None, new AsyncCallback(OnSend), clientInfo.socket);
     }
 }
Example #2
0
        //send a Data
        public void send(Data  d)
        {
            try
            {
                d.setIdNumber(localIdNumber);//sign the signature.
                byte[] message = new byte[1024];
                message.Initialize();
                d.ToByte().CopyTo(message, 0);
                clientSocket.BeginSend(message, 0, message.Length, SocketFlags.None, new AsyncCallback(OnSend), null);

            }
            catch (Exception ex)
            {

            }
        }
Example #3
0
        public void send(Data d)
        {
            byte[] message=new byte[1024];
            message.Initialize();
            d.setIdNumber(activeIdNumber);
            d.ToByte().CopyTo(message, 0);

            foreach (ClientInfo c in clientList)
            {
                if (c.idNumber==d.getIdNumber() ||d.getIdNumber()==Data.IDNUMBER_BROADCAST)
                {

                    c.socket.BeginSend(message, 0, message.Length, SocketFlags.None, new AsyncCallback(OnSend), c.socket);
                }
            }
        }