Andrew Gauntlett, 41, sent messages to who he thought was a young girl for two months.
The conversation between Gauntlett and the girl was sexual, with him telling her he wanted to have sex with her.
He also made other inappropriate comments and sent her a picture of his genitals, Southampton Magistrates Court heard.
The offences happened between June 30, 2023 and August 13, 2023.
READ MORE: Trans woman charged with rape dies before court hearing
Gauntlett, of Sedgwick Road, Bishopstoke, pleaded guilty to a charge of attempting to engage in sexual communication with a child on November 12, 2024.
Appearing at court on February 26, he was handed a prison sentence of four months suspended for two years.
The magistrates’ said: “There is realistic prospect of rehabilitation due to defendant being remorseful and on stable employment.”
Gauntlett is subject to a notification requirement where he must register his details with police for seven years.
He was ordered to pay prosecution costs of £85 and a surcharge of £154.