Such writ shall be served upon the court and party to whom it shall be directed in the same manner as a writ of mandamus; and a return shall in like manner be made thereto by such court, which may be enforced by attachment.