The Shulhan Aruch (Siman 252:6) writes that one should not carry anything in the public domain, "Samuh’ Lechashecha", because we are worried that he might forget about it, and go into the Shabbat carrying. The Be’ur Halacha and the Halacha Berura quote from a Yerushalmi that this time of "Samuch’ Leha’shecha" is two and a half hours before sunset. The Halachic authorities however, write that today, there is room to be lenient with this Halacha, being that the Reshut Harabim; the public domain today is only a rabbinical enactment. In a town where there is an Erub, even though it may be questionable if one can use this Erub on Shabbat, regarding this Halacha it can be relied on.
The Shulhan Aruch (Siman 252:7) writes that one is obligated to check his pockets for anything that would be forbidden to carry on Shabbat before Shabbat, lest, he transgress the sin of carrying in the public domain on Shabbat.
The Mishna Berura writes that even if there is an Erub in the town, a person still must check his pockets, because there might be something Mukseh in his clothing which is forbidden to touch on Shabbat. The Mishna Berura writes, that this rule of the Shulhan Aruch, also applies on Shabbat, for example, on Shabbat morning when one puts on his clothing again, he should check his pockets, for maybe something by mistake was left in them.
Summary: One may carry in the public domain even if it is within two and a half hours of sunset. One must be careful to check his pockets before the arrival of Shabbat, lest, he have anything in his pockets s which is Mukseh ,or something which is not allowed to be carried in the public domain on Shabbat.