예제 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            this.serializer = new RMSerialization();

            Button button = FindViewById<Button>(Resource.Id.MyButton);

            List<string> names = new List<string>();
            names.Add("Aaa");
            names.Add("Bbb");

            clientsListUI = FindViewById<ListView>(Resource.Id.clientsList);
            listAdapter = new BasicListViewAdapter(this, names);
            clientsListUI.Adapter = listAdapter;

            AndroidServer = new Server();
            AndroidServer.ReceivedBytes += ReceivedBytes;
            AndroidServer.StartTcp();

            string myIp = AndroidNetworkData.GetLocalIp();
            ClientInfo me = new ClientInfo("Android", myIp);
            AndroidClient = new Client(AndroidServer, me);

            byte[] msg = serializer.SerializeXmlToBytes(me);
            
            button.Click += delegate
            {
                button.Text = "Sending...";
                //client.SendTcp("192.168.0.91", 11100, msg);
                AndroidServer.MultiUdp(msg);
                button.Text = "Sent";
            };
        }
예제 #2
0
 public NetworkScanner(Server server, ClientInfo me)
 {
     this._server = server;
     this._me = me;
     this._serializer = new RMSerialization();
     this._scanWaitInterval = (int)TimeSpan.FromMinutes(5).TotalMilliseconds;
 }
예제 #3
0
 private void Init()
 {
     WindowsServer = new Server();
     WindowsClient = new Client(WindowsServer, _settings.Me);
     WindowsServer.ReceivedBytes += ReceivedBytes;
     WindowsServer.StartTcp();
 }
예제 #4
0
파일: Client.cs 프로젝트: fcin/RemindMe
        public Client(Server server, ClientInfo me)
        {
            if (server == null || me == null)
            {
                throw new ArgumentNullException();
            }

            this.Me = me;
            this.AvailableClientsInfo = new ObservableCollection<IClientInfo>();
            this.AvailableClientsInfo.CollectionChanged += AvailableClientsInfoChanged;
            this.TrusedClientsInfos = new TrustedClients();

            var netScanner = new NetworkScanner(server, Me);
            netScanner.Run();
        }