gmr / rabbitpy

A pure python, thread-safe, minimalistic and pythonic RabbitMQ client library
http://rabbitpy.readthedocs.org
BSD 3-Clause "New" or "Revised" License
243 stars 58 forks source link

socket timed out #1

Closed eandersson closed 11 years ago

eandersson commented 11 years ago

Hey,

I am testing this library on my local computer, and running it from my local RabbitMQ instance works fine, but trying to reach one of my servers hosted on the interweb gives me a socket timed out exception.

I used the exact code from the example, but changed only the host-name (also tried IP) and two different servers.

DEBUG:rabbitpy.base:Connection setting state to 'Opening'
DEBUG:rabbitpy.base:IO setting state to 'Opening'
DEBUG:rabbitpy.io:Connecting to lab-xxx:5672
Traceback (most recent call last):
  File "/home/eandersson/repo/x_x-master/xxx/horse.py", line 7, in <module>
    with rabbitpy.Connection('amqp://guest:guest@lab-xxx:5672/') as conn:
  File "/usr/local/lib/python2.7/dist-packages/rabbitpy-0.5.0p1-py2.7.egg/rabbitpy/connection.py", line 107, in __init__
    self._connect()
  File "/usr/local/lib/python2.7/dist-packages/rabbitpy-0.5.0p1-py2.7.egg/rabbitpy/connection.py", line 247, in _connect
    raise exception
socket.timeout: timed out

Both work fine with pika.

btw your socket send function, shouldn't it either be changed to sendall or slice the frame?

bytes_sent += self._write_frame_data(frame_data)

I haven't really had time yet to look into the code properly, but shouldn't it look something like this?

frame_data[bytes_sent:]
eandersson commented 11 years ago

Works great! Thanks for another awesome library.