Our enum type ServerState has an underlying integer type.
To compile and run this program, you can use a Fortran compiler like gfortran.
In this example, we define the possible states of the server using parameters (constants). We have a state_name function to convert the states to strings and a transition function to handle state transitions. The main program demonstrates these by transitioning from StateIdle to StateConnected, then back to StateIdle.