The writ shall be directed to the officer or party having the person under restraint, commanding him or her to have such person before the court or judge at such time and place as the court or judge shall direct to do and receive what shall be ordered concerning him or her, and have then and there the writ.