ive been having the same issue
Hey! Seems that you replied to a thread that was made back in October 2022 and didn't recieve any replies. Generally this is called "necro posting"; Reviving an inactive thread essentially. This isn't really something we enforce unless people do it specifically to be disruptive, but do try to check the date of a post when replying on a "Help" thread or bug report, etc. I've went ahead and locked it.
As for your issue, assuming it's also on PC then its most
likely one of two things; Try searching on google for instructions on these, as you're likely to get more specific results
1)
Your firewall is blocking Terraria network data, when you first boot up a game with networking windows firewall will usually pop-up "Windows firewall has blocked some features of this app" followed by two boxes "Allow this app to communicate on these networks" -Private/Public. If you cancelled out of this, you'll need to go into your firewall settings to allow it.
2) The
server host hasn't port-forwarded properly or made a firewall exception.
In addition to the above, there are many other factors that could interfere with it. Parental controls, ISP that doesn't allow you to port-forward, etc. If you're really stuck and none of the fixes or guides people have posted and would like help, I suggest making your own thread.
I suggest trying to connect to another server to identify if its on your end first.
I've also moved this thread to a more appropriate section for the sake of keeping things tidy.