Beispiel #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.button1);
            button.Click += button_Click;

            Button button2 = FindViewById<Button>(Resource.Id.button2);
            button2.Click += button2_Click;

            LogOut.Action += LogOut_Action;

            MessHander = new Handler(Msg =>
            {
                FindViewById<TextView>(Resource.Id.textView1).Append(Msg.Obj.ToString() + "\n");

            });


            client = new ClientInfo(GetString(Resource.String.ServerIP), int.Parse(GetString(Resource.String.ServerPort)), int.Parse(GetString(Resource.String.ServerRegPort)), int.Parse(GetString(Resource.String.MinPort)), int.Parse(GetString(Resource.String.MaxPort)), int.Parse(GetString(Resource.String.ResCount)), GetString(Resource.String.MAC));
            client.ConToServer();
            client.ClientDataIn += client_ClientDataIn;
            client.ClientConnToMe += client_ClientConnToMe;
            client.ClientDiscon += client_ClientDiscon;

          
        }
Beispiel #2
0
        private void Form1_Load(object sender, EventArgs e)
        {

            LogOut.Action+=new ActionOutHandler(LogOut_Action);
            MClient = new ClientInfo(Config.Default.ServerIP, Config.Default.ServerPort, Config.Default.ServerRegPort, Config.Default.MinPort, Config.Default.MaxPort, Config.Default.ResCount,Config.Default.Mac);

            MClient.ClientDataIn += new ClientDataInHandler(client_ClientDataIn);
            MClient.ClientConnToMe += new ClientConnToHandler(client_ClientConnToMe);
            MClient.ClientDiscon += new ClientDisconHandler(client_ClientDiscon);
            MClient.ConToServer();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            LogOut.Action += new ActionOutHandler(LogOut_Action);
            ClientInfo client = new ClientInfo(Config.Default.ServerIP, Config.Default.ServerPort, Config.Default.ServerRegPort, Config.Default.MinPort, Config.Default.MaxPort, Config.Default.ResCount);
            client.ConToServer();
            client.ClientDataIn += new ClientDataInHandler(client_ClientDataIn);
            client.ClientConnToMe += new ClientConnToHandler(client_ClientConnToMe);
            client.ClientDiscon += new ClientDisconHandler(client_ClientDiscon);

            while (true)
            {
                byte[] data = Encoding.UTF8.GetBytes(Console.ReadLine());

                foreach (KeyValuePair<string, ConClient> keyv in client.ConnUserList)
                {
                    keyv.Value.SendData(data);
                }
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            LogOut.Action += new ActionOutHandler(LogOut_Action);
            ClientInfo client = new ClientInfo(Config.Default.ServerIP, Config.Default.ServerPort, Config.Default.ServerRegPort, Config.Default.MinPort, Config.Default.MaxPort, Config.Default.ResCount,Config.Default.MAC);
            client.ConToServer();
            client.ClientDataIn += new ClientDataInHandler(client_ClientDataIn);
            client.ClientConnToMe += new ClientConnToHandler(client_ClientConnToMe);
            client.ClientDiscon += new ClientDisconHandler(client_ClientDiscon);

            while (true)
            {
                byte[] data = Encoding.UTF8.GetBytes(Console.ReadLine());

                List<string> userlist = client.GetAllUser();

                foreach (var item in userlist)
                {
                    client.SendData(item, data);
                }
            }
        }