Beispiel #1
0
        private static void TestDBServerConnection(string line, int lineNumber, DBServerInfo dbi)
        {
            TestedConnection tc = HelperMethods.ConnectionTested(dbi.Name);

            if (tc != null)
            {
                Errors.ConnectivityError(lineNumber, dbi.Name, tc.Reason, tc.StatusCode, 2);
            }
            else
            {
                IPAddress[] IPs = Dns.GetHostAddresses(dbi.Name);
                Socket      s   = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                int port;
                int.TryParse(dbi.Port, out port);

                try
                {
                    s.Connect(IPs[0], port);
                    HelperMethods.AddConnection(dbi.Name, 0, "", 2, dbi.Port);
                }
                catch
                {
                    int sc = Errors.GetStatusCode("ServerConnectionError");
                    Errors.ConnectivityError(lineNumber, dbi.Name, "Could not connect to remote server.", sc, 2);
                    HelperMethods.AddConnection(dbi.Name, sc, "Could not connect to remote server.", 2, dbi.Port);
                }
                finally
                {
                    s.Close();
                    s.Dispose();
                }
            }
        }
Beispiel #2
0
 private static void TestServerRegion(int lineNumber, DBServerInfo dbi, string line)
 {
     if (Program.Region.ToUpper() != dbi.Region.ToUpper())
     {
         Errors.ServerDiscrepancy(lineNumber, dbi.Name, line);
     }
 }