Exemplo n.º 1
0
        public void ClientHandlerSerialTest2()
        {
            ClientSocket cs = new ClientSocket();
            Socket       s  = cs.ConnectToServer();
            SerialBytes  sb = new SerialBytes(s);

            try
            {
                sb.Recived += PrintObject;
            }
            catch (Exception)
            {
            }
            DataClassTrans d1 = new DataClassTrans("test1");
            DataClassTrans d2 = new DataClassTrans("test2");
            DataClassTrans d3 = new DataClassTrans("test3");
            DataClassTrans d4 = new DataClassTrans("test4");

            sb.Send(d1);
            Thread.Sleep(50);
            sb.Send(d2);
            Thread.Sleep(50);
            sb.Send(d3);
            Thread.Sleep(50);
            sb.Send(d4);
        }
Exemplo n.º 2
0
        public void JsonTest3()
        {
            ClientSocket cs = new ClientSocket();
            Socket       s  = cs.ConnectToServer();
            JsonBytes    jb = new JsonBytes(s);

            try
            {
                jb.Recived += PrintObject;
            }
            catch (Exception)
            {
            }
            DataClassTrans d1 = new DataClassTrans("test1");
            DataClassTrans d2 = new DataClassTrans("test2");
            DataClassTrans d3 = new DataClassTrans("test3");
            DataClassTrans d4 = new DataClassTrans("test4");

            jb.Send(d1);
            Thread.Sleep(50);
            jb.Send(d2);
            Thread.Sleep(50);
            jb.Send(d3);
            Thread.Sleep(50);
            jb.Send(d4);
        }
Exemplo n.º 3
0
        private void btnStart_Click(object sender, EventArgs e)     //btnConnetti: per connettersi/disconnettersi dal server
        {
            if (connected)
            {
                cs.Close();
                return;
            }

            cs.ConnectToServer(this.txtIpAddress.Text, Int32.Parse(this.txtPortNumber.Text));
        }
Exemplo n.º 4
0
        public void StringTest()
        {
            ClientSocket cs = new ClientSocket();
            Socket       s  = cs.ConnectToServer();
            StringBytes  sb = new StringBytes(s);

            sb.Send("test1");
            Thread.Sleep(50);
            sb.Send("test2");
            Thread.Sleep(50);
            sb.Send("test3");
            Thread.Sleep(50);
            sb.Send("test4");
        }
Exemplo n.º 5
0
        public ChatWindow()
        {
            InitializeComponent();

            CurrentChatWindow = this;

            ClientSocket.ConnectToServer();

            CheckMessagesBackgroundWorker =
                new BackgroundWorker
            {
                WorkerSupportsCancellation = true
            };                                                                             //Vi skal bruge en backgroundworker, til at kalde metoden ReceiveMessage på
            //en ny tråd. Dette gør vi så UI'en ikke fryser.
            CheckMessagesBackgroundWorker.DoWork += CheckMessagesBackgroundWorkerOnDoWork; //Når backgroundworkeren er startet, skal den kalde metoden, som nævnt.
        }
Exemplo n.º 6
0
        public void SerialTest()
        {
            ClientSocket   cs = new ClientSocket();
            Socket         s  = cs.ConnectToServer();
            SerialBytes    sb = new SerialBytes(s);
            DataClassTrans d1 = new DataClassTrans("test1");
            DataClassTrans d2 = new DataClassTrans("test2");
            DataClassTrans d3 = new DataClassTrans("test3");
            DataClassTrans d4 = new DataClassTrans("test4");

            sb.Send(d1);
            Thread.Sleep(50);
            sb.Send(d2);
            Thread.Sleep(50);
            sb.Send(d3);
            Thread.Sleep(50);
            sb.Send(d4);
        }