First, in step S621, the control unit 102 stores the number of services supported by the digital camera 100 as a variable N prepared in the RAM of the storage unit 103. In the present embodiment, it will be assumed that the digital camera 100 supports, for example, a file transfer service for transferring files of images and the like, a video output service for outputting videos to a television or a similar display, and a print service for transmitting images to the printer 304 and printing the images. Therefore, the number of services supported by the digital camera 100 is three.
In step S622, the control unit 102 prepares a variable n indicating a service targeted for processing in the RAM of the storage unit 103, and stores one as the variable n. In step S623, the control unit 102 determines whether the nth service (that is to say, one of the aforementioned three services) is included among the services and the communication apparatuses that were discovered through the service search started in step S602. If the control unit 102 determines that the nth service is included, it proceeds to step S624; if it determines that the nth service is not included, it proceeds to step S627.