예제 #1
0
        public void MyProcess()
        {
            while (mysign.sign)
            {
                IPEndPoint sender = new IPEndPoint(IPAddress.Any,0);
                byte[] recv = _socket.Receive(ref sender);

                string androidIP = Encoding.UTF8.GetString(recv, 0, recv.Length);
                AndSocketEventArgs e = new AndSocketEventArgs(androidIP);
                if (AndSocketReceived != null)
                {
                    AndSocketReceived(this,e);
                }
                if (androidIP.StartsWith("IP;"))
                {
                    MyClient.SendMessage(androidIP.Split(';')[1], 4860, GetIP());
                }
            }
        }
예제 #2
0
        void myserver_AndSocketReceived(object sender, AndSocketEventArgs e)
        {
            dd a = delegate()
            {
                rtxt_log.AppendText(Environment.NewLine);
                rtxt_log.AppendText(e.info);
            };
            rtxt_log.Invoke(a);

            if (e.info.StartsWith("SHUT_DOWN;"))
            {
                String tip=e.info.Split(';')[1];
                IPAddress[] ips = Utils.GetIPs();

                foreach (IPAddress ip in ips)
                {
                    if(ip.ToString()==tip)
                        ShowDownWindow();
                }
            }
        }