A communication apparatus to which a user can log in, comprising: a wireless communication unit configured to provide a direct wireless communication function of performing wireless communication with an external device without using an external relay device therebetween; and a controller configured to control the wireless communication unit to stop the direct wireless communication function in response to the user's logging out from the communication apparatus in a case where a first type of a service set identifier, SSID, is set on the communication apparatus as the type of SSID to be used in the direct wireless communication function, wherein, in a case where a second type of SSID is set on the communication apparatus as the type of SSID to be used in the direct wireless communication function for allowing communication with a plurality of external devices using the direct wireless communication function, the direct wireless communication function is not stopped in response to the user' s logging out from the communication apparatus, wherein the second type of SSID is a predetermined, fixed SSID and the first type of SSID is a type of SSID other than a predetermined, fixed SSID, wherein, in a case where the second type of SSID is set on the communication apparatus as the type of SSID to be used, a predetermined number of external devices of two or more is set as an upper limit of the number of external devices to be connected by the direct wireless communication function provided by the wireless communication unit, and, in a case where the first type of SSID is set on the communication apparatus as the type of SSID to be used, the upper limit of the number of external devices to be connected by the direct wireless communication function is set to 1. a wireless communication unit configured to provide a direct wireless communication function of performing wireless communication with an external device without using an external relay device therebetween; and a controller configured to control the wireless communication unit to stop the direct wireless communication function in response to the user's logging out from the communication apparatus in a case where a first type of a service set identifier, SSID, is set on the communication apparatus as the type of SSID to be used in the direct wireless communication function, wherein, in a case where a second type of SSID is set on the communication apparatus as the type of SSID to be used in the direct wireless communication function for allowing communication with a plurality of external devices using the direct wireless communication function, the direct wireless communication function is not stopped in response to the user' s logging out from the communication apparatus, wherein the second type of SSID is a predetermined, fixed SSID and the first type of SSID is a type of SSID other than a predetermined, fixed SSID, wherein, in a case where the second type of SSID is set on the communication apparatus as the type of SSID to be used, a predetermined number of external devices of two or more is set as an upper limit of the number of external devices to be connected by the direct wireless communication function provided by the wireless communication unit, and, in a case where the first type of SSID is set on the communication apparatus as the type of SSID to be used, the upper limit of the number of external devices to be connected by the direct wireless communication function is set to 1. <EOS>