title: How to troubleshoot failure to open a socket - amqp / rabbitmq-c
body: <p>I am trying to Hello World the rabbitmq-c implementation of AMQP.</p>
  
  <p>I have a small script adopted from the example included with the rabbitmq-c source. Here's a snippet:</p>
  
  <pre><code>  socket = amqp_tcp_socket_new(conn);
    if (!socket) {
      die("creating TCP socket");
    }
  
    status = amqp_socket_open(socket, hostname, port);
    if (status) {
          die(amqp_error_string2(status));
    }
    printf ("Error opening socket: %s\n",strerror(errno));
  </code></pre>
  
  <p>If I run this on the same host as the rabbitmq server process (i.e., <code>hostname</code> is <code>localhost</code>), then the script connects and sends a message which is received by a listener. If I run this same program on a different box and supply the hostname of the box running Rabbit, then it dies when it tries to open the socket with a -9, which is just "a socket error occurred". "errno" is just the <code>EINPROGRESS</code> which is expected when I try to open a non-blocking socket. (It's the same error I see as when the program succeeds).</p>
  
  <p>On failure, nothing shows up in the rabbitmq server log.</p>
  
  <p>While I'd love it if someone could tell me specifically what's going wrong here, I'm really in need of a fishing pole. I have no idea how to get the information I need from the system here, not even really where to begin. I've never really done unix I/O before. Could anyone make some suggestions about debugging next steps?</p>