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"; }; }
public NetworkScanner(Server server, ClientInfo me) { this._server = server; this._me = me; this._serializer = new RMSerialization(); this._scanWaitInterval = (int)TimeSpan.FromMinutes(5).TotalMilliseconds; }
private void Init() { WindowsServer = new Server(); WindowsClient = new Client(WindowsServer, _settings.Me); WindowsServer.ReceivedBytes += ReceivedBytes; WindowsServer.StartTcp(); }
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(); }