private void updateAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            byte[] raw_message;
            byte[] raw_receive;
            string receive;

            string[] friend_list;
            string[] friend_state;

            int receive_size = 0;

            online_node.Nodes.Clear();
            offline_node.Nodes.Clear();

            raw_message = Encoding.ASCII.GetBytes("friend_list");

            sendsize(client, raw_message.Length);
            client.Write(raw_message, 0, raw_message.Length);

            receive_size = getsize(client);
            raw_receive  = new byte[receive_size];
            client.Read(raw_receive, 0, receive_size);

            receive     = Encoding.ASCII.GetString(raw_receive);
            friend_list = receive.Split(' ');

            for (int i = 1; i < friend_list.Length; i++)
            {
                friends.Add(friend_list[i]);
            }


            for (int i = 1; i < friend_list.Length; i++)
            {
                friend_state = friend_list[i].Split(':');

                if (friend_state[1].Contains("online"))
                {
                    online_node.Nodes.Add(friend_state[0]);
                }
                else
                {
                    offline_node.Nodes.Add(friend_state[0]);
                }
            }

            Friend_view.Show();
        }
        private void Form2_Load(object sender, EventArgs e)
        {
            byte[] raw_message;
            string message;

            byte[] raw_receive;
            string receive;

            string[] friend_list;
            string[] message_arg;
            string[] friend_state;

            int sender_idx, receive_size = 0;

            chat_list.Clear();
            chatbox.Items.Clear();

            raw_message = Encoding.ASCII.GetBytes("friend_list");

            sendsize(client, raw_message.Length);
            client.Write(raw_message, 0, raw_message.Length);

            receive_size = getsize(client);
            raw_receive  = new byte[receive_size];
            client.Read(raw_receive, 0, receive_size);

            receive     = Encoding.ASCII.GetString(raw_receive);
            friend_list = receive.Split(' ');

            for (int i = 1; i < friend_list.Length; i++)
            {
                friends.Add(friend_list[i]);
            }

            raw_message = Encoding.ASCII.GetBytes("receive");

            sendsize(client, raw_message.Length);
            client.Write(raw_message, 0, raw_message.Length);

            receive_size = getsize(client);
            raw_receive  = new byte[receive_size];
            client.Read(raw_receive, 0, receive_size);

            receive = Encoding.ASCII.GetString(raw_receive);

            if (receive == "No_message")
            {
            }
            else if (receive == "message")
            {
                while (true)
                {
                    receive_size = getsize(client);
                    raw_receive  = new byte[receive_size];
                    client.Read(raw_receive, 0, receive_size);

                    receive = Encoding.ASCII.GetString(raw_receive);

                    if (receive == "End")
                    {
                        break;
                    }

                    message_arg = receive.Split('|');

                    sender_idx = int.Parse(message_arg[0]);
                    message_list[sender_idx].Add(message_arg[1]);
                }
            }

            for (int i = 1; i < friend_list.Length; i++)
            {
                friend_state = friend_list[i].Split(':');

                if (friend_state[1].Contains("online"))
                {
                    online_node.Nodes.Add(friend_state[0]);
                }
                else
                {
                    offline_node.Nodes.Add(friend_state[0]);
                }
            }

            Friend_view.Show();
        }