docs: public void run()
      {
          this.serverSocket = null;
          try
          {
              Log(Level.INFO, "Attempting to create SocketServer...");
              // If requrestedPortNumber is 0 and we have a range of ports specified, then attempt to allocate a port dynamically from that range.
              if (this.requestedPortNumber == 0 && this.portRangeMax != -1 && this.portRangeMin != -1) {
                  this.serverSocket = TCPUtils.getSocketInRange(this.portRangeMin, this.portRangeMax, this.choosePortRandomly);
                  if (this.serverSocket == null)
                      throw new Exception("Could not allocate port from range.");
              } else	// Attempt to use the requested port - if it's 0, the system will allocate one dynamically.
                  this.serverSocket = new ServerSocket(this.requestedPortNumber);	// Use the specified port number
          }
          catch (Exception e)
          {
              SysLog(Level.SEVERE, "Failed to create SocketServer: " + e);
              this.failedToCreate = true;
              return;
          }
  
          SysLog(Level.INFO, "Listening for messages on port " + this.serverSocket.getLocalPort());
  
          while (keepRunning)
          {
              Socket socket = null;
              try
              {
                  Log(Level.INFO, "Waiting for incoming message...");
                  socket = this.serverSocket.accept();
                  if (socket != null)
                      Log(Level.INFO, "Connected to: " + socket.getLocalAddress() + "(local), " + socket.getRemoteSocketAddress() + "(remote)");
                  else
                      Log(Level.WARNING, "Accept() returns a null socket!?");
              }
              catch (SocketException e)
              {
                  SysLog(Level.INFO, "Socket exception - usually caused by ServerSocket being closed under our feet (normal for stopping polling): " + e);
              }
              catch (IOException e)
              {
                  SysLog(Level.SEVERE, "Failed to accept socket request: " + e);
              }
  
              if (socket != null)
              {
                  this.connection_count++;
                  Runnable connectionHandler = new TCPConnectionHandler(socket, this, this.logname + ":S#" + this.connection_count);
                  new Thread(connectionHandler).start();
              }
          }
  
          if (this.serverSocket != null)
          {
              try
              {
                  Log(Level.INFO, "Closing server socket...");
                  this.serverSocket.close();
                  Log(Level.INFO, "...closed okay.");
              }
              catch (IOException e)
              {
                  Log(Level.SEVERE, "Something went wrong closing server socket: " + e);
              }
          }
      }