try typing in your computers Local IP address (like 192.168.0.100) instead of the public address (which would be like 18.104.22.168).
Run command prompt (run > cmd.exe) and type "ipconfig" and hit enter and it will tell you your IP address.
Connecting to your local server is different then someone outside your network connecting to your server because you don't want to go outside your network and back in.
You may also need to setup port forwarding on your router.
Running your own server is difficult to setup, make sure you have a guide on how to do it properly, it shouldn't be hard to google how to do it right.