A method for optimizing the use of gateways (GW1,GW2,GW3) based on a category of message to be sent by a connected object, said connected object being able to access several gateways (GW1,GW2,GW3) suitable for transmitting a message sent by the connected object, said optimization method being characterized in that: - a procedure of discovery, by the connected object, of available gateways for the connected object, said procedure of discovery comprising: ∘ broadcasting by the connected object a query message in a plurality of data transport subnets (11,12,13), and ∘ receiving by the connected object response messages (131,132) sent by each of the available gateways in response to the query message, said response messages (131,132) containing gateway connectivity parameters and a value of the validity time of said connectivity parameters; - a procedure of attributing priority levels (P1.1, P1.2,P2.1, P2.2) to the available gateways (GW1,GW2) by category of message to be sent, said procedure for attributing priority levels comprising the execution (211, 212) by the connected object of at least one prioritization function, in order to calculate priority levels for each gateway from connectivity parameters and based on the category of message to be sent; and - a procedure of classifying by the connected object the available gateways by order of their respective priority levels based on the category of message to be sent, with a view to choosing one of said available gateways for sending data messages; and in that the priority levels (P1.1,P1.2,P2.1,P2.2) of the available gateways (GW1,GW2) by category of message are transmitted by the connected object to other connected objects. - a procedure of discovery, by the connected object, of available gateways for the connected object, said procedure of discovery comprising: ∘ broadcasting by the connected object a query message in a plurality of data transport subnets (11,12,13), and ∘ receiving by the connected object response messages (131,132) sent by each of the available gateways in response to the query message, said response messages (131,132) containing gateway connectivity parameters and a value of the validity time of said connectivity parameters; ∘ broadcasting by the connected object a query message in a plurality of data transport subnets (11,12,13), and ∘ receiving by the connected object response messages (131,132) sent by each of the available gateways in response to the query message, said response messages (131,132) containing gateway connectivity parameters and a value of the validity time of said connectivity parameters; - a procedure of attributing priority levels (P1.1, P1.2,P2.1, P2.2) to the available gateways (GW1,GW2) by category of message to be sent, said procedure for attributing priority levels comprising the execution (211, 212) by the connected object of at least one prioritization function, in order to calculate priority levels for each gateway from connectivity parameters and based on the category of message to be sent; and - a procedure of classifying by the connected object the available gateways by order of their respective priority levels based on the category of message to be sent, with a view to choosing one of said available gateways for sending data messages;