Errno 104 Connection reset by peer` error

Nikhil Rupanawar picture Nikhil Rupanawar · Feb 6, 2013 · Viewed 24.3k times · Source

I have following code snippet. Previously it was working fine and was printing output

But after now when i did change my machine's phisical loaction location within same network I get error: [Errno 104] Connection reset by peer error IP is same for machine.

I am using Scientific Linux 6.1

 operation='GET'
 url="/apifactory/api"
 url_request = "%s HTTP/1.1" %url
 connect = httplib.HTTPSConnection('myhost.com')
 try:
      connect.request(operation,url_request,'')
 except Exception,obj:
      connect.close()
      print traceback.format_exc()


 response_obj=connect.getresponse()
 data=response_obj.read()
 connect.close()
 print data


Traceback:
  File "/usr/local/lib/python2.7/ssl.py", line 121, in __init__
  self.do_handshake()
  File "/usr/local/lib/python2.7/ssl.py", line 281, in do_handshake
  self._sslobj.do_handshake()
  error: [Errno 104] Connection reset by peer

I tried with openssl s_client -connect myhost.com:443 It gives:

  CONNECTED(00000003)
  write:errno=104
  no peer certificate available
  No client certificate CA names sent
  SSL handshake has read 0 bytes and written 113 bytes
  New, (NONE), Cipher is (NONE)
  Secure Renegotiation IS NOT supported
  Compression: NONE
  Expansion: NONE

All working fine before changing the location. What can be possible cause ? is there any change regarding opesssl configuration or certification?

Answer