Example #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";
            };
        }
Example #2
0
 private void Init()
 {
     WindowsServer = new Server();
     WindowsClient = new Client(WindowsServer, _settings.Me);
     WindowsServer.ReceivedBytes += ReceivedBytes;
     WindowsServer.StartTcp();
 }