Socket error: [Errno 111] Connection refused

Hi Smart People!!

I have an issue I can’t seem to determine the solution. First, the code:

self.credentials = {'devicekey': config.vars['devicekey']}
globalVars.hologram = HologramCloud(self.credentials, network='cellular')

result =
if result == False:
    print 'Failed to connect to cell network'

location =
#check if the monitor is requesting a location update
recv = globalVars.hologram.popReceivedMessage()
print recv

What I’m trying to do is return the location of the device, then check if there are any pending Cloud Data messages. I can get it to receive messages only if I don’t check the location prior to receiving.

The Hologram Dashboard always returns an error, and is always one of the two:

  • Socket error: [Errno 111] Connection refused
  • Socket error: timed out

Any ideas? Thanks!

Furthermore, I also tried an event subscription. I can get the subscription to work also, for as long as I don’t try to access network.location:

globalVars.hologram.event.subscribe('message.received', self.messageReceived)
result =
# location = #doesn't work
def messageReceived(self):
      print "hello! I received something!"
      recv = globalVars.hologram.popReceivedMessage()
      print recv

This error means that the client cannot connect to the port on the computer running server script. This can be caused by few things, like lack of routing to the destination or you have a firewall somewhere between your client and the server - it could be on server itself or on the client etc. Note that a server must perform the sequence socket(), bind(), listen(), accept() (possibly repeating the accept() to service more than one client), while a client only needs the sequence socket(), connect(). Also note that the server does not sendall()/recv() on the socket it is listening on but on the new socket returned by accept(). Try the following:

  • Check if you really have that port listening on the server (this should tell you if your code does what you think it should): based on you OS, but on linux you could do something like netstat -ntulp
  • Check from the server, if you’re accepting the connections to the server: again based on your OS, but telnet LISTENING_IP LISTENING_PORT should do the job
  • Check if you can access the port of the server from the client , but not using the code: just us the telnet (or appropriate command for your OS) from the client