I'm still a beginning programmer but I like to experiment and learn while practicing. I play League of Legends a lot, this is the biggest online game today. Sometimes the server of this game are offline and my idea was to make a java programm that checks wether the game is online (ports are open) and then tells me if the game is online or not. Due to me being a beginner programmer and my understanding of ports/network adresses still lack a bit, I wonder if someone could explain or help me achieving my goal. If it is by explaining or providing helpfull links, I'm open to everything!
Thanks in advance,
Boris
There are some tools that you can check that whether the server is alive or not.
The most basic one is ping in CMD:
ping stackoverflow.com (if you have domain)
or
ping 198.252.206.16 (if you have IP)
if you see sth like this so server is alive and give a response: Ping statistics for 198.252.206.16: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 142ms, Maximum = 145ms, Average = 143ms
But if you see this, then server or your internet connection has a problem: Request timed out.
There are some other tools such as Hercules to test a server alive or not.
If you are still sure to write a program yourself in java, you can try to create a new java.net.Socket. If that line throws any exception then you are not able to connect to the server. To manage this, you should use "try-catch" blocks.