Ejemplo n.º 1
0
 public static void SendMsg2NotifyThread(Object msg)
 {
     if (msg != null && msg.GetType() == typeof(SendMsg2Notify))
     {
         SendMsg2Notify smn = (SendMsg2Notify)msg;
         smn.SendOneThread();
     }
 }
        public void UdpNotifyMsg_Reponse(IPAddress addr, int port)
        {
            byte[] buf = this.GetNotifyMessageXml(false);

            for (int i = 0; i < mUdpSetverPort.Length; i++)
            {
                IPEndPoint     endpoint = new IPEndPoint(addr, mUdpSetverPort[i]);
                SendMsg2Notify sm2n     = new SendMsg2Notify(addr.ToString(), buf, endpoint);
            }
        }
        public void UdpNotifyMsg_heart(IPAddress addr, int port)
        {
            byte[] buf = this.GetNotifyMessageXml("isalive");

            for (int i = 0; i < NetFindfTransfer.mUdpSetverPort.Length; i++)
            {
                IPEndPoint     endpoint = new IPEndPoint(addr, NetFindfTransfer.mUdpSetverPort[i]);
                SendMsg2Notify smn      = new SendMsg2Notify(addr.ToString(), buf, endpoint);
            }
        }
        public void UdpNotifyMsg_Request(IPAddress[] addrArray)
        {
#if false
            UdpClient client = new UdpClient(new IPEndPoint(IPAddress.Any, 0));
            foreach (IPAddress addr in addrArray)
            {
                byte[] buf = this.GetNotifyMessageXml(addr.ToString().EndsWith(".255"));
                for (int i = 0; i < mUdpSetverPort.Length; i++)
                {
                    IPEndPoint endpoint = new IPEndPoint(addr, mUdpSetverPort[i]);
                    client.Send(buf, buf.Length, endpoint);
                }
            }
            client.Close();
#endif
#if false
            foreach (IPAddress addr in addrArray)
            {
                byte[] buf = this.GetNotifyMessageXml(addr.ToString().EndsWith(".255"));
                for (int i = 0; i < mUdpSetverPort.Length; i++)
                {
                    IPEndPoint      endpoint = new IPEndPoint(addr, mUdpSetverPort[i]);
                    UdpNotifyAllDev unad     = new UdpNotifyAllDev(addr.ToString(), buf, endpoint);
                    unad.StartThread();
                }
            }
#endif
#if true
            byte[] buf = this.GetNotifyMessageXml(true);
            foreach (IPAddress addr in addrArray)
            {
                for (int i = 0; i < mUdpSetverPort.Length; i++)
                {
                    IPEndPoint     endpoint = new IPEndPoint(addr, mUdpSetverPort[i]);
                    SendMsg2Notify sm2n     = new SendMsg2Notify(addr.ToString(), buf, endpoint);
                }
            }
#endif
        }