A method for controlling communication in a communication system in which a mobile terminal forms an ad hoc network together with at least one gateway terminal, the method comprising:
- a retrieving step of retrieving an adjacent gateway terminal that is one of said at least one gateway terminal;
- a creating or updating step of creating or updating an adjacent terminal information table based upon information on said at least one gateway terminal and information on the adjacent gateway terminal;
- a grouping step of grouping the gateway terminals on the basis of a result of the retrieval in the retrieving step;
- a location registration area information transmitting step of transmitting the group formed in the grouping step to the mobile terminal as first location registration area information;
- a comparing step of comparing the first location registration area information transmitted to the mobile terminal with second location registration area information stored beforehand in the mobile terminal;
- a determination step of determining whether or not the first location registration area information has been changed from the second location registration area information;
- and
- a location registration signal transmitting step of transmitting a location registration signal only when the first location registration are information is determined to have been changed in the determination step;
- wherein the grouping step includes:
- a determining step of determining whether or not the adjacent gateway terminal is present;
- a determining step of determining, when the adjacent gateway terminal is present, whether or not the adjacent gateway terminal already belongs to a group;
- a determining step of determining, when the adjacent gateway terminal belongs to the group, whether or not the number of gateway terminals belonging to the group is smaller than a predetermined maximum number of the gateway terminals;
- an adding step of adding the adjacent gateway terminal to the group, when the number of gateway terminals belonging to the group is smaller than the predetermined maximum number;
- and
- a determining step of determining whether or not another adjacent gateway terminal is present, when the number of the gateway terminals belonging to the group is equal to or greater than the predetermined maximum number,
- wherein whether or not the adjacent gateway terminal already belongs to the group and whether or not said another adjacent gateway terminal is present are determined by referring to an adjacent terminal information table that includes a correspondence between location registration area information and information on the gateway terminal and the adjacent gateway terminal.