Exemple #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            SocketPacket reqfriendpacket = new SocketPacket(PacketType.REQFRIEND, getlocalIP(), serverip, 52052, 52054);

            DataTranferer.Send(serverip, 52054, reqfriendpacket);
            ThreadStart receivethread = new ThreadStart(ReceiveFromServer);
            Thread      thread1       = new Thread(receivethread);

            thread1.IsBackground = true;
            thread1.Start();
        }
Exemple #2
0
        private void button1_MouseClick(object sender, MouseEventArgs e)
        {
            this.Visible = false;

            SocketPacket packet       = new SocketPacket(PacketType.REQCON, localIP, txbserverip.Text, 52052, 52054, txbName.Text);
            SocketPacket returnpacket = DataTranferer.SendAndReceive(txbserverip.Text, 52054, packet);

            if (returnpacket.Message == "OK")
            {
                MainForm main = new MainForm(txbserverip.Text, txbName.Text);
                main.ShowDialog();
                this.Close();
            }
            else
            {
                MessageBox.Show(returnpacket.Message);
            }
        }
Exemple #3
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            SocketPacket disconnect = new SocketPacket(PacketType.DISCON, getlocalIP(), serverip, 52052, 52054);

            DataTranferer.Send(serverip, 52052, disconnect);
        }