Wireless sensor networks are increasingly used in applications for monitoring large systems (forest fires, gas in the mine galleries, ethology, ...). A characteristic of these applications is that the topology of the network will be dynamic, either the sensors are geographically mobile (dispersion of an oil slick) or environmental conditions change and modify the communication capabilities of these sensors. Also, from a connex system, we can move to a clustered system that presents a discontinuity of the global connectivity, and therefore of the information system. One solution is to use one (or more) collector (s) that will restore a discrete connectivity at fixed deadlines to reconstruct a coherent information system. We have proposed a clustering algorithm of the wireless sensor network which is adapted to the dynamics of its topology. The chosen metric takes into account the density and the mobility of nodes and their remaining energy. Then we designed a session-layer protocol allowing the collector to reconstruct the context of communication with the previously visited clusters, knowing that they have evolved in number, splitting, merging, ... To do this, it is necessary to dynamically generate the trajectory of the collector, on the basis of a model of the topology, taking into account the application requirements (frequency and volume of the collected information). For the validation of the proposed clustering algorithm and the session-layer protocol, we defined a sensor model we have integrated in the Opnet simulation environment.