From 6e1cb6236ce79ab42be33d477e467102143456f0 Mon Sep 17 00:00:00 2001 From: brutzman <brutzman@DESKTOP-2S09UKA> Date: Sun, 11 Aug 2019 17:12:38 -0700 Subject: [PATCH] parameterize host address --- .../src/UdpMulticastHttpExamples/HttpWebPageSource.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/src/UdpMulticastHttpExamples/HttpWebPageSource.java b/examples/src/UdpMulticastHttpExamples/HttpWebPageSource.java index 82532b504a..882081c885 100644 --- a/examples/src/UdpMulticastHttpExamples/HttpWebPageSource.java +++ b/examples/src/UdpMulticastHttpExamples/HttpWebPageSource.java @@ -23,9 +23,11 @@ public class HttpWebPageSource { System.out.println("Reference: https://tools.ietf.org/html/rfc7230"); 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 want. Note that the format for the command is very @@ -34,7 +36,7 @@ public class HttpWebPageSource { PrintStream ps = new PrintStream(os); String message = "GET /index.html HTTP/1.0"; - ps.print(message); + ps.print(message); // to socket System.out.println(message); System.out.println(); -- GitLab