Package memory

Class ServerMain

java.lang.Object
memory.ServerMain

public class ServerMain
extends Object
Game server runner.

PS4 instructions: you are encouraged *not* to modify this class.

  • Method Details

    • main

      public static void main​(String[] args) throws IOException
      Start a game server using the given arguments.

      Command-line usage:

       java memory.ServerMain PORT FILENAME 
      where:

      PORT is an integer that specifies the server's listening port number, according to the spec of java.net.ServerSocket(int). 0 specifies that a random unused port will be automatically chosen.

      FILENAME is the path to a valid board file, which will be loaded as the starting game board.

      For example, to start a web server on a randomly-chosen port using the board in boards/hearts.txt:

       0 boards/hearts.txt 
      Parameters:
      args - arguments as described above
      Throws:
      IOException - if an error occurs parsing a file or starting a server