Skip to content
Snippets Groups Projects
Commit 6e1cb623 authored by brutzman's avatar brutzman
Browse files

parameterize host address

parent 67a1448f
No related branches found
No related tags found
No related merge requests found
...@@ -23,9 +23,11 @@ public class HttpWebPageSource { ...@@ -23,9 +23,11 @@ public class HttpWebPageSource {
System.out.println("Reference: https://tools.ietf.org/html/rfc7230"); System.out.println("Reference: https://tools.ietf.org/html/rfc7230");
System.out.println(); System.out.println();
// We request an IP to connect to a web server running on port 80. // We request an IP to connect to a web server running on default http port 80.
Socket socket = new Socket("www.MovesInstitute.org", 80); String WEB_ADDRESS = "www.nps.edu";
System.out.println("New socket WEB_ADDRESS=" + WEB_ADDRESS);
Socket socket = new Socket(WEB_ADDRESS, 80); // compare alternative: https on port 443
// we send a command to the web server, asking for what // we send a command to the web server, asking for what
// we want. Note that the format for the command is very // we want. Note that the format for the command is very
...@@ -34,7 +36,7 @@ public class HttpWebPageSource { ...@@ -34,7 +36,7 @@ public class HttpWebPageSource {
PrintStream ps = new PrintStream(os); PrintStream ps = new PrintStream(os);
String message = "GET /index.html HTTP/1.0"; String message = "GET /index.html HTTP/1.0";
ps.print(message); ps.print(message); // to socket
System.out.println(message); System.out.println(message);
System.out.println(); System.out.println();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment