Example #1
0
        public static void Main()
        {
            while (true)
            {

                try
                {
                    IP = null;
                    Application.Run(new InputIp());
                    tcpclnt = new TcpClient();
                    if (IP == null)
                        return;
                    Console.WriteLine(IP);
                    tcpclnt.Connect(IP, 8001);
                    Console.WriteLine("Connection established");
                    gui = new MinesweeperGUI();
                    Application.Run(gui);
                    break;
                }
                catch (Exception e)
                {
                    MessageBox.Show("Could not establish a connection with the server: " + e.Message);
                }
            }
        }
Example #2
0
        public static void Main()
        {
            while (true)
            {

                try
                {
                    IP = null;
                    Application.Run(new InputIp());
                    clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    if (IP == null)
                        return;
                    clientSocket.Connect(IP, port);
                    Console.WriteLine("Connection established");
                    gui = new MinesweeperGUI();
                    Application.Run(gui);
                    if (closingReason != String.Empty)
                        MessageBox.Show(closingReason);
                    break;
                }
                catch (Exception e)
                {
                    MessageBox.Show("Could not establish a connection with the server: " + e.Message);
                }
                clientSocket.Close();
            }
        }