A communication apparatus comprising: wireless communication means; recording means; and control means, wherein, in a case where connection with a relay apparatus is established by the wireless communication means, the control means control the recording means to record information on a network formed by the relay apparatus, and information on whether a stealth mode, in which the relay apparatus transmits a beacon not including an identifier of the network, is enabled for the network, as history information, wherein, in a case where a beacon, which does not include an identifier of a network, is received by the wireless communication means in a state where the history information (310, 320, 330) includes information on a network for which the stealth mode is enabled, which was recorded due to a connection with the network in the past, the control means is configured to control the wireless communication means to start wireless connection to the relay apparatus that forms the network, which is recorded in the history information (310, 320, 330), for which the stealth mode is enabled, wherein the history information (310, 320, 330) further includes a parameter representing priority for networks, wherein the control means is configured to control the wireless communication means to start wireless connection to a relay apparatus that forms the network for which the parameter represents the highest priority, wherein, in a case where the stealth mode is enabled for a network for which the parameter represents the highest priority, the control means is configured to control the wireless communication means to start wireless connection to the relay apparatus that forms the network, for which the parameter represents the highest priority, in response to receive a beacon that does not include the identifier of a network, wherein, in a case where the stealth mode is disabled for the network for which the parameter represents the highest priority, the control means is configured to control the wireless communication means to start wireless connection to the relay apparatus that forms the network, for which the parameter represents the highest priority, and wherein, in a case where connection with a relay apparatus is established by the wireless communication means, the control means is configured to control the recording means to record the parameter included in history information (310, 320, 330) on the network formed by the relay apparatus connected with the communication apparatus, so as to represent a higher priority than that represented by the parameter included in history information on all other networks. wireless communication means; recording means; and control means, wherein, in a case where connection with a relay apparatus is established by the wireless communication means, the control means control the recording means to record information on a network formed by the relay apparatus, and information on whether a stealth mode, in which the relay apparatus transmits a beacon not including an identifier of the network, is enabled for the network, as history information, wherein, in a case where a beacon, which does not include an identifier of a network, is received by the wireless communication means in a state where the history information (310, 320, 330) includes information on a network for which the stealth mode is enabled, which was recorded due to a connection with the network in the past, the control means is configured to control the wireless communication means to start wireless connection to the relay apparatus that forms the network, which is recorded in the history information (310, 320, 330), for which the stealth mode is enabled, wherein the history information (310, 320, 330) further includes a parameter representing priority for networks, wherein the control means is configured to control the wireless communication means to start wireless connection to a relay apparatus that forms the network for which the parameter represents the highest priority, wherein, in a case where the stealth mode is enabled for a network for which the parameter represents the highest priority, the control means is configured to control the wireless communication means to start wireless connection to the relay apparatus that forms the network, for which the parameter represents the highest priority, in response to receive a beacon that does not include the identifier of a network, wherein, in a case where the stealth mode is disabled for the network for which the parameter represents the highest priority, the control means is configured to control the wireless communication means to start wireless connection to the relay apparatus that forms the network, for which the parameter represents the highest priority, and wherein, in a case where connection with a relay apparatus is established by the wireless communication means, the control means is configured to control the recording means to record the parameter included in history information (310, 320, 330) on the network formed by the relay apparatus connected with the communication apparatus, so as to represent a higher priority than that represented by the parameter included in history information on all other networks.