An image processing apparatus, comprising: reception means configured to receive instruction information, for receiving instruction information from an instruction server via a router having a firewall function, and a session server, which is configured to set up a session between the image processing apparatus and the instruction server; state control means configured to control a state of the image processing apparatus to be one of a plurality of states including a normal state and a power saving state in which a power consumption is smaller than a power consumption in the normal state; packet transmission means configured to transmit a connection confirmation packet for the session between the image processing apparatus and the instruction server, to the session server; and adjustment means configured to adjust a transmission interval of the packet transmitted by the packet transmission means, based on a connection state of the session between the instruction server and the image processing apparatus after connection confirmation, so that the transmission interval is within a session timeout period for the firewall function of the router, the state control means being configured to switch the state of the image processing apparatus to a state in which the packet transmission means can at least transmit a packet, in a case where the state of the image processing apparatus is the power saving state when a time specified by the transmission interval elapses from transmission of the packet by the packet transmission means, wherein the adjustment means is configured to extend the transmission interval in a case where the session between the image processing apparatus and the instruction server is connected, and shorten the transmission interval in a case where the session between the image processing apparatus and the instruction server is disconnected and decrease a value of a time by which the transmission interval is shortened or extended, in a case where a result which represents connection or disconnection of the session between the image processing apparatus and the instruction server is different from a result derived from preceding packet transmission. reception means configured to receive instruction information, for receiving instruction information from an instruction server via a router having a firewall function, and a session server, which is configured to set up a session between the image processing apparatus and the instruction server; state control means configured to control a state of the image processing apparatus to be one of a plurality of states including a normal state and a power saving state in which a power consumption is smaller than a power consumption in the normal state; packet transmission means configured to transmit a connection confirmation packet for the session between the image processing apparatus and the instruction server, to the session server; and adjustment means configured to adjust a transmission interval of the packet transmitted by the packet transmission means, based on a connection state of the session between the instruction server and the image processing apparatus after connection confirmation, so that the transmission interval is within a session timeout period for the firewall function of the router, the state control means being configured to switch the state of the image processing apparatus to a state in which the packet transmission means can at least transmit a packet, in a case where the state of the image processing apparatus is the power saving state when a time specified by the transmission interval elapses from transmission of the packet by the packet transmission means, wherein the adjustment means is configured to extend the transmission interval in a case where the session between the image processing apparatus and the instruction server is connected, and shorten the transmission interval in a case where the session between the image processing apparatus and the instruction server is disconnected and extend the transmission interval in a case where the session between the image processing apparatus and the instruction server is connected, and shorten the transmission interval in a case where the session between the image processing apparatus and the instruction server is disconnected and decrease a value of a time by which the transmission interval is shortened or extended, in a case where a result which represents connection or disconnection of the session between the image processing apparatus and the instruction server is different from a result derived from preceding packet transmission.