Failed to open TCP connection

18,566

Start by checking your network configuration.

Run this command on your terminal: dig +short graph.facebook.com

If you do not get any IP address, your system don't know how to resolve this and the problem is not related to Ruby.

In addition to that as mentioned by Dawood Awan in his comment, opening a TCP connection to the port 443 is usually not a good idea, I am pretty sure facebook is excepting an HTTPS Connection.

Share:
18,566
Bryan Zamora
Author by

Bryan Zamora

Updated on June 04, 2022

Comments

  • Bryan Zamora
    Bryan Zamora almost 2 years

    While attempting to open a TCP connection to graph.facebook.com, I receive the following error:

    Failed to open TCP connection to graph.facebook.com:443 (getaddrinfo: Name or service not known)

    TCPSocket.open(conn_address, conn_port, @local_host, @local_port)
            rescue => e
              raise e, "Failed to open TCP connection to " +
                "#{conn_address}:#{conn_port} (#{e.message})"
            end
          }
    

    Help me with this error

    I'm using omniauth with Rails 5.0.0.beta3

    • Dawood Awan
      Dawood Awan almost 8 years
      443 is used for HTTPS - how can you connect to a HTTPS service using TCP protocol? You have to generate a HTTP or HTTPS request not TCP Connection
    • tadman
      tadman almost 8 years
      What's the intent of this code? Opening a raw TCP connection seems utterly pointless. When asking for help don't forget to include what those variables are defined as so others can reproduce your problem.
    • ElementalStorm
      ElementalStorm over 5 years
      @DawoodAwan HTTP and HTTPS both use TCP as underlying protocol. When you connect to an HTTP(S) server you are using a TCP connection.
  • marknuzz
    marknuzz over 2 years
    The above code is word for word taken from the ruby http library and is executed on a standard https request