Protocol Not Found socket.getprotobyname
<p>I'm trying to connect to an rabbitMQ server but the it keeps failing on connection with a <code>socket.error: protocol not found</code> error.  </p>

<pre><code>In [1]: import pika

In [2]: pika.BlockingConnection(pika.ConnectionParameters('ip_of_server'))
</code></pre>

<p>with error output of </p>

<pre><code>---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
&lt;ipython-input-2-7adc44418966&gt; in &lt;module&gt;()
----&gt; 1 pika.BlockingConnection(pika.ConnectionParameters('localhost')
      2 )

/usr/lib/python2.7/dist-packages/pika/adapters/blocking_connection.pyc in __init__(self, parameters)
    105
    106         """
--&gt; 107         super(BlockingConnection, self).__init__(parameters, None, False)
    108
    109     def add_on_close_callback(self, callback_method_unused):

/usr/lib/python2.7/dist-packages/pika/adapters/base_connection.pyc in __init__(self, parameters, on_open_callback, on_open_error_callback, on_close_callback, ioloop, stop_ioloop_on_close)
     60                                              on_open_callback,
     61                                              on_open_error_callback,
---&gt; 62                                              on_close_callback)
     63
     64     def add_timeout(self, deadline, callback_method):

/usr/lib/python2.7/dist-packages/pika/connection.pyc in __init__(self, parameters, on_open_callback, on_open_error_callback, on_close_callback)
    588         # Initialize the connection state and connect
    589         self._init_connection_state()
--&gt; 590         self.connect()
    591
    592     def add_backpressure_callback(self, callback_method):

/usr/lib/python2.7/dist-packages/pika/adapters/blocking_connection.pyc in connect(self)
    204         """
    205         self._set_connection_state(self.CONNECTION_INIT)
--&gt; 206         if not self._adapter_connect():
    207             raise exceptions.AMQPConnectionError('Could not connect')
    208

/usr/lib/python2.7/dist-packages/pika/adapters/blocking_connection.pyc in _adapter_connect(self)
    272         # Remove the default behavior for connection errors
    273         self.callbacks.remove(0, self.ON_CONNECTION_ERROR)
--&gt; 274         if not super(BlockingConnection, self)._adapter_connect():
    275             raise exceptions.AMQPConnectionError(1)
    276         self.socket.settimeout(self.SOCKET_CONNECT_TIMEOUT)

/usr/lib/python2.7/dist-packages/pika/adapters/base_connection.pyc in _adapter_connect(self)
    103         # Get the addresses for the socket, supporting IPv4 &amp; IPv6
    104         sock_addrs = socket.getaddrinfo(self.params.host, self.params.port,
--&gt; 105                             0, 0, socket.getprotobyname("tcp"))
    106
    107         # Iterate through each addr tuple trying to connect

error: protocol not found
</code></pre>

<p>I read this as it was failing on the socket.getprotobyname line in base_connection.pyc.  I then tried to use socket.getprotobyname on it's own and I keep getting <code>error: protocol not found</code>.  It obviously can't fine my TCP connection. </p>

<p>From what I can tell, it should output <code>6</code></p>

<pre><code>In [5]: import socket

In [6]: socket.getprotobyname('tcp')
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
&lt;ipython-input-6-3a85adf1710a&gt; in &lt;module&gt;()
----&gt; 1 socket.getprotobyname('tcp')

error: protocol not found
</code></pre>

<p>I am using Ubuntu 14.04 and python 2.7.6 and I have no idea how to troubleshoot this error.  </p>

<p>I've read some threads about the /etc/protocols file, but I do not seem to have one. Can this be the problem?  If so, is there a generic file I can download or a method to create one?</p>