public client()
        {
            bool      conn   = true;
            TcpClient client = new TcpClient();

            Console.WriteLine("skriv porten. Example: 5001");
            int port = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("skriv ip'en. \n example: 127.0.0.1");
            IPAddress  ip       = IPAddress.Parse(Console.ReadLine());
            IPEndPoint endPoint = new IPEndPoint(ip, port);

            client.Connect(endPoint);

            NetworkStream stream  = client.GetStream();
            Smethods      smethod = new Smethods();

            smethod.ReceiveMessages(stream);
            Console.WriteLine("Du kan skrive beskeder nu");
            while (conn)
            {
                smethod.cmessage(stream);
            }
            client.Close();
        }
        void ClientServer()
        {
            string     ipInput  = "f**k";
            bool       bol      = true;
            int        port     = 0;
            IPAddress  ip       = IPAddress.Any;
            IPEndPoint endpoint = new IPEndPoint(ip, 5001);

            TcpListener listener = new TcpListener(endpoint);

            listener.Start();
            while (bol)
            {
                Smethods funktioner = new Smethods();
                if (Console.ReadKey(true).Key == ConsoleKey.Enter)
                {
                    if (ipInput == "f**k")
                    {
                        Console.WriteLine("skriv den ip du vil sende til\n example: 127.0.0.1");
                        ipInput = Console.ReadLine();
                        Console.WriteLine("Skriv hvilken port du vil sende det til\n example 5001");
                        port = Convert.ToInt32(Console.ReadLine());
                    }
                    TcpClient  clients        = new TcpClient();
                    IPAddress  ipp            = IPAddress.Parse(ipInput);
                    IPEndPoint remoteEndpoint = new IPEndPoint(ipp, port);
                    clients.Connect(remoteEndpoint);
                    NetworkStream streams    = clients.GetStream();
                    string        message    = Console.ReadLine();
                    byte[]        buffersixe = Encoding.UTF8.GetBytes(message);

                    streams.Write(buffersixe, 0, message.Length);
                    clients.Close();
                }
                TcpClient     client = listener.AcceptTcpClient();
                NetworkStream stream = client.GetStream();
                funktioner.ReceiveMessages(stream);
            }
            listener.Stop();
        }