Skip to content

Commit

Permalink
better server address printing
Browse files Browse the repository at this point in the history
  • Loading branch information
jpolitz committed Apr 21, 2023
1 parent dce4797 commit 340169a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions DocSearchServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down
4 changes: 3 additions & 1 deletion Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.InetAddress;
import java.net.URI;

import com.sun.net.httpserver.HttpExchange;
Expand Down Expand Up @@ -48,6 +49,7 @@ public static void start(int port, URLHandler handler) throws IOException {

//start the server
server.start();
System.out.println("Server Started! Visit http://localhost:" + port + " to visit.");
System.out.println("Server started at http://" + InetAddress.getLocalHost().getHostName() + ":" + port);
System.out.println("(Or, if it's running locally on this computer, use http://localhost:" + port + " )");
}
}

0 comments on commit 340169a

Please sign in to comment.