Example #1
0
        public static void StartServer()
        {
            IPAddress lookback;

            if (IPAddress.TryParse(myip, out lookback))
            {
                MyNetwork = new Network();
                TcpListener listener = new TcpListener(lookback, 6969);
                listener.Start();
                System.Diagnostics.Debug.WriteLine("Waiting for Connection");
                while (true)
                {
                    try
                    {
                        TcpClient client = listener.AcceptTcpClient();
                        MyNetwork.AddToList(client);
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine(e.Message);
                    }
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("CANT PARSE FOCK OFF");
            }
        }