def connect_ip150socket(address, port):
try:
print "trying to connect %s" % address
logging.info("Connecting to %s" % address)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(2)
s.connect((address, port))
print "connected"
except Exception, e:
logging.error( "Error connecting to IP module (exiting): " + repr(e))
print "error connecting"
client.publish(Topic_Publish_AppState,
"Error connecting to IP module (exiting): " + repr(e),
0, True)
sys.exit()
return s
评论列表
文章目录