Package memory

Class WebServer

java.lang.Object
memory.WebServer

public class WebServer
extends Object
HTTP web game server.

PS4 instructions: the specifications of WebServer(Board, int), port(), start(), and stop() may not be changed.

  • Constructor Summary

    Constructors 
    Constructor Description
    WebServer​(Board board, int port)
    Make a new web game server using board that listens for connections on port.
  • Method Summary

    Modifier and Type Method Description
    int port()  
    void start()
    Start this server in a new background thread.
    void stop()
    Stop this server.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WebServer

      public WebServer​(Board board, int port) throws IOException
      Make a new web game server using board that listens for connections on port.
      Parameters:
      board - shared game board
      port - server port number
      Throws:
      IOException - if an error occurs starting the server
  • Method Details

    • port

      public int port()
      Returns:
      the port on which this server is listening for connections
    • start

      public void start()
      Start this server in a new background thread.
    • stop

      public void stop()
      Stop this server. Once stopped, this server cannot be restarted.