def send_command(self, command):
logger.debug("<STR_LIT>", self.socket_file_path)<EOL>sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)<EOL>try:<EOL><INDENT>sock.connect(self.socket_file_path)<EOL><DEDENT>except IOError as e:<EOL><INDENT>if e.errno == errno.ECONNREFUSED:<EOL><INDENT>logger.error("<STR_LIT>")<EOL>return<EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>sock.sendall((command + "<STR_LIT:\n>").encode())<EOL>response = b"<STR_LIT>"<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>chunk = sock.recv(SOCKET_BUFFER_SIZE)<EOL>if chunk:<EOL><INDENT>response += chunk<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>except IOError as e:<EOL><INDENT>if e.errno not in (errno.EAGAIN, errno.EINTR):<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>sock.close()<EOL>return self.process_command_response(command, response)<EOL>
Sends a given command to the HAProxy control socket.

Returns the response from the socket as a string.

If a known error response (e.g. "Permission denied.") is given then
the appropriate exception is raised.