{"id":26597,"date":"2021-04-29T23:10:08","date_gmt":"2021-04-30T03:10:08","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/webclient-client-application-that-can-talk-interactively-to-web-servers-requires-the-components-listed-below-programming-code-examples-java-j2ee-j2me-network-programming\/"},"modified":"2021-04-29T23:10:08","modified_gmt":"2021-04-30T03:10:08","slug":"webclient-client-application-that-can-talk-interactively-to-web-servers-requires-the-components-listed-below-programming-code-examples-java-j2ee-j2me-network-programming","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=26597","title":{"rendered":"WebClient &#8211; Client application that can talk interactively to Web servers. Requires the components listed below #Programming Code Examples #Java\/J2EE\/J2ME #Network Programming"},"content":{"rendered":"<pre>\nWebClient - Client application that can talk interactively to Web servers. Requires the components listed below\n\nimport java.awt.*; \/\/ For BorderLayout, GridLayout, Font, Color.\nimport java.awt.event.*;\nimport java.util.*;\nimport javax.swing.*;\n\n\/** A graphical client that lets you interactively connect to\n *  Web servers and send custom request lines and\n *  request headers.\n *\n *  Taken from Core Web Programming from\n *  Prentice Hall and Sun Microsystems Press,\n *  .\n *  &copy; 2001 Marty Hall and Larry Brown;\n *  may be freely used or adapted.\n *\/\n\npublic class WebClient extends JPanel\n    implements Runnable, Interruptible, ActionListener {\n  public static void main(String[] args) {\n    WindowUtilities.setNativeLookAndFeel();\n    WindowUtilities.openInJFrame(new WebClient(), 600, 700,\n                                 &quot;Web Client&quot;,\n                                 SystemColor.control);\n  }\n\n  private LabeledTextField hostField, portField,\n          requestLineField;\n  private JTextArea requestHeadersArea, resultArea;\n  private String host, requestLine;\n  private int port;\n  private String[] requestHeaders = new String[30];\n  private JButton submitButton, interruptButton;\n  private boolean isInterrupted = false;\n\n  public WebClient() {\n    setLayout(new BorderLayout(5, 30));\n    int fontSize = 14;\n    Font labelFont =\n      new Font(&quot;Serif&quot;, Font.BOLD, fontSize);\n    Font headingFont =\n      new Font(&quot;SansSerif&quot;, Font.BOLD, fontSize+4);\n    Font textFont =\n      new Font(&quot;Monospaced&quot;, Font.BOLD, fontSize-2);\n    JPanel inputPanel = new JPanel();\n    inputPanel.setLayout(new BorderLayout());\n    JPanel labelPanel = new JPanel();\n    labelPanel.setLayout(new GridLayout(4,1));\n    hostField = new LabeledTextField(&quot;Host:&quot;, labelFont,\n                                     30, textFont);\n    portField = new LabeledTextField(&quot;Port:&quot;, labelFont,\n                                     &quot;80&quot;, 5, textFont);\n    \/\/ Use HTTP 1.0 for compatibility with the most servers.\n    \/\/ If you switch this to 1.1, you *must* supply a\n    \/\/ Host: request header.\n    requestLineField =\n      new LabeledTextField(&quot;Request Line:&quot;, labelFont,\n                           &quot;GET \/ HTTP\/1.0&quot;, 50, textFont);\n    labelPanel.add(hostField);\n    labelPanel.add(portField);\n    labelPanel.add(requestLineField);\n    JLabel requestHeadersLabel =\n      new JLabel(&quot;Request Headers:&quot;);\n    requestHeadersLabel.setFont(labelFont);\n    labelPanel.add(requestHeadersLabel);\n    inputPanel.add(labelPanel, BorderLayout.NORTH);\n    requestHeadersArea = new JTextArea(5, 80);\n    requestHeadersArea.setFont(textFont);\n    JScrollPane headerScrollArea =\n      new JScrollPane(requestHeadersArea);\n    inputPanel.add(headerScrollArea, BorderLayout.CENTER);\n    JPanel buttonPanel = new JPanel();\n    submitButton = new JButton(&quot;Submit Request&quot;);\n    submitButton.addActionListener(this);\n    submitButton.setFont(labelFont);\n    buttonPanel.add(submitButton);\n    inputPanel.add(buttonPanel, BorderLayout.SOUTH);\n    add(inputPanel, BorderLayout.NORTH);\n    JPanel resultPanel = new JPanel();\n    resultPanel.setLayout(new BorderLayout());\n    JLabel resultLabel =\n      new JLabel(&quot;Results&quot;, JLabel.CENTER);\n    resultLabel.setFont(headingFont);\n    resultPanel.add(resultLabel, BorderLayout.NORTH);\n    resultArea = new JTextArea();\n    resultArea.setFont(textFont);\n    JScrollPane resultScrollArea =\n      new JScrollPane(resultArea);\n    resultPanel.add(resultScrollArea, BorderLayout.CENTER);\n    JPanel interruptPanel = new JPanel();\n    interruptButton = new JButton(&quot;Interrupt Download&quot;);\n    interruptButton.addActionListener(this);\n    interruptButton.setFont(labelFont);\n    interruptPanel.add(interruptButton);\n    resultPanel.add(interruptPanel, BorderLayout.SOUTH);\n    add(resultPanel, BorderLayout.CENTER);\n  }\n\n  public void actionPerformed(ActionEvent event) {\n    if (event.getSource() == submitButton) {\n      Thread downloader = new Thread(this);\n      downloader.start();\n    } else if (event.getSource() == interruptButton) {\n      isInterrupted = true;\n    }\n  }\n\n  public void run() {\n    isInterrupted = false;\n    if (hasLegalArgs())\n      new HttpClient(host, port, requestLine,\n\t\t     requestHeaders, resultArea, this);\n  }\n\n  public boolean isInterrupted() {\n    return(isInterrupted);\n  }\n\n  private boolean hasLegalArgs() {\n    host = hostField.getTextField().getText();\n    if (host.length() == 0) {\n      report(&quot;Missing hostname&quot;);\n      return(false);\n    }\n    String portString =\n      portField.getTextField().getText();\n    if (portString.length() == 0) {\n      report(&quot;Missing port number&quot;);\n      return(false);\n    }\n    try {\n      port = Integer.parseInt(portString);\n    } catch(NumberFormatException nfe) {\n      report(&quot;Illegal port number: &quot; + portString);\n      return(false);\n    }\n    requestLine =\n      requestLineField.getTextField().getText();\n    if (requestLine.length() == 0) {\n      report(&quot;Missing request line&quot;);\n      return(false);\n    }\n    getRequestHeaders();\n    return(true);\n  }\n\n  private void report(String s) {\n    resultArea.setText(s);\n  }\n\n  private void getRequestHeaders() {\n    for(int i=0; i&lt;requestheaders .length; i++) {\n      requestHeaders[i] = null;\n    }\n    int headerNum = 0;\n    String header =\n      requestHeadersArea.getText();\n    StringTokenizer tok =\n      new StringTokenizer(header, &quot;rn&quot;);\n    while (tok.hasMoreTokens()) {\n      requestHeaders[headerNum++] = tok.nextToken();\n    }\n  }\n}\n\n\nHttpClient.java  Handles the underlying network communication. \n\nimport java.net.*;\nimport java.io.*;\nimport javax.swing.*;\n\n\/** The underlying network client used by WebClient.\n *\n *  Taken from Core Web Programming from\n *  Prentice Hall and Sun Microsystems Press,\n *  .\n *  &copy; 2001 Marty Hall and Larry Brown;\n *  may be freely used or adapted.\n *\/\n\npublic class HttpClient extends NetworkClient {\n  private String requestLine;\n  private String[] requestHeaders;\n  private JTextArea outputArea;\n  private Interruptible app;\n\n  public HttpClient(String host, int port,\n                    String requestLine, String[] requestHeaders,\n                    JTextArea outputArea, Interruptible app) {\n    super(host, port);\n    this.requestLine = requestLine;\n    this.requestHeaders = requestHeaders;\n    this.outputArea = outputArea;\n    this.app = app;\n    if (checkHost(host)) {\n      connect();\n    }\n  }\n\n  protected void handleConnection(Socket uriSocket)\n      throws IOException {\n    try {\n      PrintWriter out = SocketUtil.getWriter(uriSocket);\n      BufferedReader in = SocketUtil.getReader(uriSocket);\n      outputArea.setText(&quot;&quot;);\n      out.println(requestLine);\n      for(int i=0; i&lt;requestHeaders.length; i++) {\n        if (requestHeaders[i] == null) {\n          break;\n        } else {\n          out.println(requestHeaders[i]);\n        }\n      }\n      out.println();\n      String line;\n      while ((line = in.readLine()) != null &amp;&amp;\n             !app.isInterrupted()) {\n        outputArea.append(line + &quot;n&quot;);\n      }\n      if (app.isInterrupted()) {\n        outputArea.append(&quot;---- Download Interrupted ----&quot;);\n      }\n    } catch(Exception e) {\n      outputArea.setText(&quot;Error: &quot; + e);\n    }\n  }\n\n  private boolean checkHost(String host) {\n    try {\n      InetAddress.getByName(host);\n      return(true);\n    } catch(UnknownHostException uhe) {\n      outputArea.setText(&quot;Bogus host: &quot; + host);\n      return(false);\n    }\n  }\n}\n\n\nLabeledTextField.java  A labeled text field for the WebClient graphical user interface.\n\nimport java.awt.*; \/\/ For FlowLayout, Font.\nimport javax.swing.*;\n\n\/** A TextField with an associated Label.\n *\n *  Taken from Core Web Programming from\n *  Prentice Hall and Sun Microsystems Press,\n *  .\n *  &copy; 2001 Marty Hall and Larry Brown;\n *  may be freely used or adapted.\n *\/\n\npublic class LabeledTextField extends JPanel {\n  private JLabel label;\n  private JTextField textField;\n\n  public LabeledTextField(String labelString,\n                          Font labelFont,\n                          int textFieldSize,\n                          Font textFont) {\n    setLayout(new FlowLayout(FlowLayout.LEFT));\n    label = new JLabel(labelString, JLabel.RIGHT);\n    if (labelFont != null) {\n      label.setFont(labelFont);\n    }\n    add(label);\n    textField = new JTextField(textFieldSize);\n    if (textFont != null) {\n      textField.setFont(textFont);\n    }\n    add(textField);\n  }\n\n  public LabeledTextField(String labelString,\n                          String textFieldString) {\n    this(labelString, null, textFieldString,\n         textFieldString.length(), null);\n  }\n\n  public LabeledTextField(String labelString,\n                          int textFieldSize) {\n    this(labelString, null, textFieldSize, null);\n  }\n\n  public LabeledTextField(String labelString,\n                          Font labelFont,\n                          String textFieldString,\n                          int textFieldSize,\n                          Font textFont) {\n    this(labelString, labelFont,\n         textFieldSize, textFont);\n    textField.setText(textFieldString);\n  }\n\n  \/** The Label at the left side of the LabeledTextField.\n   *  To manipulate the Label, do:\n   *  <\/pre>\n<pre>\n   *    LabeledTextField ltf = new LabeledTextField(...);\n   *    ltf.getLabel().someLabelMethod(...);\n   *  <\/pre>\n<p>   *\/<\/p>\n<p>  public JLabel getLabel() {<br \/>\n    return(label);<br \/>\n  }<\/p>\n<p>  \/** The TextField at the right side of the<br \/>\n   *  LabeledTextField.<br \/>\n   *\/<\/p>\n<p>  public JTextField getTextField() {<br \/>\n    return(textField);<br \/>\n  }<br \/>\n}<\/p>\n<p>Interruptible.java  Polls to see if the user choose to interrupt the current network download.<\/p>\n<p>\/** An interface for classes that can be polled to see<br \/>\n *  if they&#8217;ve been interrupted. Used by HttpClient<br \/>\n *  and WebClient to allow the user to interrupt a network<br \/>\n *  download.<br \/>\n *<br \/>\n *  Taken from Core Web Programming from<br \/>\n *  Prentice Hall and Sun Microsystems Press,<br \/>\n *  .<br \/>\n *  &copy; 2001 Marty Hall and Larry Brown;<br \/>\n *  may be freely used or adapted.<br \/>\n *\/<\/p>\n<p>public interface Interruptible {<br \/>\n  public boolean isInterrupted();<br \/>\n}<\/p>\n<p>NetworkClient.java  Starting point for a network client to communicate with a remote computer. <\/p>\n<p>import java.net.*;<br \/>\nimport java.io.*;<\/p>\n<p>\/** A starting point for network clients. You&#8217;ll need to<br \/>\n *  override handleConnection, but in many cases connect can<br \/>\n *  remain unchanged. It uses SocketUtil to simplify the<br \/>\n *  creation of the PrintWriter and BufferedReader.<br \/>\n *<br \/>\n *  Taken from Core Web Programming from<br \/>\n *  Prentice Hall and Sun Microsystems Press,<br \/>\n *  &copy; 2001 Marty Hall and Larry Brown;<br \/>\n *  may be freely used or adapted.<br \/>\n *\/<\/p>\n<p>public class NetworkClient {<br \/>\n  protected String host;<br \/>\n  protected int port;<\/p>\n<p>  \/** Register host and port. The connection won&#8217;t<br \/>\n   *  actually be established until you call<br \/>\n   *  connect.<br \/>\n   *\/<\/p>\n<p>  public NetworkClient(String host, int port) {<br \/>\n    this.host = host;<br \/>\n    this.port = port;<br \/>\n  }<\/p>\n<p>  \/** Establishes the connection, then passes the socket<br \/>\n   *  to handleConnection.<br \/>\n   *\/<\/p>\n<p>  public void connect() {<br \/>\n    try {<br \/>\n      Socket client = new Socket(host, port);<br \/>\n      handleConnection(client);<br \/>\n    } catch(UnknownHostException uhe) {<br \/>\n      System.out.println(&quot;Unknown host: &quot; + host);<br \/>\n      uhe.printStackTrace();<br \/>\n    } catch(IOException ioe) {<br \/>\n      System.out.println(&quot;IOException: &quot; + ioe);<br \/>\n      ioe.printStackTrace();<br \/>\n    }<br \/>\n  }<\/p>\n<p>  \/** This is the method you will override when<br \/>\n   *  making a network client for your task.<br \/>\n   *  The default version sends a single line<br \/>\n   *  (&quot;Generic Network Client&quot;) to the server,<br \/>\n   *  reads one line of response, prints it, then exits.<br \/>\n   *\/<\/p>\n<p>  protected void handleConnection(Socket client)<br \/>\n    throws IOException {<br \/>\n    PrintWriter out = SocketUtil.getWriter(client);<br \/>\n    BufferedReader in = SocketUtil.getReader(client);<br \/>\n    out.println(&quot;Generic Network Client&quot;);<br \/>\n    System.out.println<br \/>\n      (&quot;Generic Network Client:n&quot; +<br \/>\n       &quot;Made connection to &quot; + host +<br \/>\n       &quot; and got &#8216;&quot; + in.readLine() + &quot;&#8217; in response&quot;);<br \/>\n    client.close();<br \/>\n  }<\/p>\n<p>  \/** The hostname of the server we&#8217;re contacting. *\/<\/p>\n<p>  public String getHost() {<br \/>\n    return(host);<br \/>\n  }<\/p>\n<p>  \/** The port connection will be made on. *\/<\/p>\n<p>  public int getPort() {<br \/>\n    return(port);<br \/>\n  }<br \/>\n}<\/p>\n<p>SocketUtil.java: Provides utilities for wrapping a BufferedReader  and PrintWriter around the Socket&#8217;s input and output streams, respectively. <\/p>\n<p>import java.net.*;<br \/>\nimport java.io.*;<\/p>\n<p>\/** A shorthand way to create BufferedReaders and<br \/>\n *  PrintWriters associated with a Socket.<br \/>\n *<br \/>\n *  Taken from Core Web Programming from<br \/>\n *  Prentice Hall and Sun Microsystems Press,<br \/>\n *  .<br \/>\n *  &copy; 2001 Marty Hall and Larry Brown;<br \/>\n *  may be freely used or adapted.<br \/>\n *\/<\/p>\n<p>public class SocketUtil {<br \/>\n  \/** Make a BufferedReader to get incoming data. *\/<\/p>\n<p>  public static BufferedReader getReader(Socket s)<br \/>\n      throws IOException {<br \/>\n    return(new BufferedReader(<br \/>\n       new InputStreamReader(s.getInputStream())));<br \/>\n  }<\/p>\n<p>  \/** Make a PrintWriter to send outgoing data.<br \/>\n   *  This PrintWriter will automatically flush stream<br \/>\n   *  when println is called.<br \/>\n   *\/<\/p>\n<p>  public static PrintWriter getWriter(Socket s)<br \/>\n      throws IOException {<br \/>\n    \/\/ Second argument of true means autoflush.<br \/>\n    return(new PrintWriter(s.getOutputStream(), true));<br \/>\n  }<br \/>\n}<\/p>\n<p>WindowUtilities.java  Simplifies the setting of native look and feel.<\/p>\n<p>import javax.swing.*;<br \/>\nimport java.awt.*;   \/\/ For Color and Container classes.<\/p>\n<p>\/** A few utilities that simplify using windows in Swing.<br \/>\n *<br \/>\n *  Taken from Core Web Programming from<br \/>\n *  Prentice Hall and Sun Microsystems Press,<br \/>\n *  &copy; 2001 Marty Hall and Larry Brown;<br \/>\n *  may be freely used or adapted.<br \/>\n *\/<\/p>\n<p>public class WindowUtilities {<\/p>\n<p>  \/** Tell system to use native look and feel, as in previous<br \/>\n   *  releases. Metal (Java) LAF is the default otherwise.<br \/>\n   *\/<\/p>\n<p>  public static void setNativeLookAndFeel() {<br \/>\n    try {<br \/>\n     UIManager.setLookAndFeel(<br \/>\n       UIManager.getSystemLookAndFeelClassName());<br \/>\n    } catch(Exception e) {<br \/>\n      System.out.println(&quot;Error setting native LAF: &quot; + e);<br \/>\n    }<br \/>\n  }<\/p>\n<p>  public static void setJavaLookAndFeel() {<br \/>\n    try {<br \/>\n     UIManager.setLookAndFeel(<br \/>\n       UIManager.getCrossPlatformLookAndFeelClassName());<br \/>\n    } catch(Exception e) {<br \/>\n      System.out.println(&quot;Error setting Java LAF: &quot; + e);<br \/>\n    }<br \/>\n  }<\/p>\n<p>   public static void setMotifLookAndFeel() {<br \/>\n    try {<br \/>\n      UIManager.setLookAndFeel(<br \/>\n        &quot;com.sun.java.swing.plaf.motif.MotifLookAndFeel&quot;);<br \/>\n    } catch(Exception e) {<br \/>\n      System.out.println(&quot;Error setting Motif LAF: &quot; + e);<br \/>\n    }<br \/>\n  }<\/p>\n<p>  \/** A simplified way to see a JPanel or other Container. Pops<br \/>\n   *  up a JFrame with specified Container as the content pane.<br \/>\n   *\/<\/p>\n<p>  public static JFrame openInJFrame(Container content,<br \/>\n                                    int width,<br \/>\n                                    int height,<br \/>\n                                    String title,<br \/>\n                                    Color bgColor) {<br \/>\n    JFrame frame = new JFrame(title);<br \/>\n    frame.setBackground(bgColor);<br \/>\n    content.setBackground(bgColor);<br \/>\n    frame.setSize(width, height);<br \/>\n    frame.setContentPane(content);<br \/>\n    frame.addWindowListener(new ExitListener());<br \/>\n    frame.setVisible(true);<br \/>\n    return(frame);<br \/>\n  }<\/p>\n<p>  \/** Uses Color.white as the background color. *\/<\/p>\n<p>  public static JFrame openInJFrame(Container content,<br \/>\n                                    int width,<br \/>\n                                    int height,<br \/>\n                                    String title) {<br \/>\n    return(openInJFrame(content, width, height,<br \/>\n                        title, Color.white));<br \/>\n  }<\/p>\n<p>  \/** Uses Color.white as the background color, and the<br \/>\n   *  name of the Container&#8217;s class as the JFrame title.<br \/>\n   *\/<\/p>\n<p>  public static JFrame openInJFrame(Container content,<br \/>\n                                    int width,<br \/>\n                                    int height) {<br \/>\n    return(openInJFrame(content, width, height,<br \/>\n                        content.getClass().getName(),<br \/>\n                        Color.white));<br \/>\n  }<br \/>\n}<\/p>\n<p>ExitListener.java  WindowListener for applications in this chapter.<\/p>\n<p>import java.awt.*;<br \/>\nimport java.awt.event.*;<\/p>\n<p>\/** A listener that you attach to the top-level JFrame of<br \/>\n *  your application, so that quitting the frame exits the<br \/>\n *  application.<br \/>\n *<br \/>\n *  Taken from Core Web Programming from<br \/>\n *  Prentice Hall and Sun Microsystems Press,<br \/>\n *  &copy; 2001 Marty Hall and Larry Brown;<br \/>\n *  may be freely used or adapted.<br \/>\n *\/<br \/>\npublic class ExitListener extends WindowAdapter {<br \/>\n  public void windowClosing(WindowEvent event) {<br \/>\n    System.exit(0);<br \/>\n  }<br \/>\n}<\/p>\n<p>Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From: http:\/\/sitestree.com\/?p=10234<br \/> Categories:Programming Code Examples, Java\/J2EE\/J2ME, Network Programming<br \/>Tags:Java\/J2EE\/J2MENetwork Programming<br \/> Post Data:2017-01-02 16:04:28<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WebClient &#8211; Client application that can talk interactively to Web servers. Requires the components listed below import java.awt.*; \/\/ For BorderLayout, GridLayout, Font, Color. import java.awt.event.*; import java.util.*; import javax.swing.*; \/** A graphical client that lets you interactively connect to * Web servers and send custom request lines and * request headers. * * Taken &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=26597\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-26597","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":10198,"url":"http:\/\/bangla.sitestree.com\/?p=10198","url_meta":{"origin":26597,"position":0},"title":"WebClient &#8211; Client application that can talk interactively to Web servers. Requires the components listed below","author":"","date":"August 25, 2015","format":false,"excerpt":"import java.awt.*; \/\/ For BorderLayout, GridLayout, Font, Color. import java.awt.event.*; import java.util.*; import javax.swing.*; \/** A graphical client that lets you interactively connect to \u00a0*\u00a0 Web servers and send custom request lines and \u00a0*\u00a0 request headers. \u00a0* \u00a0*\u00a0 Taken from Core Web Programming from \u00a0*\u00a0 Prentice Hall and Sun Microsystems\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10192,"url":"http:\/\/bangla.sitestree.com\/?p=10192","url_meta":{"origin":26597,"position":1},"title":"UrlRetriever.java Accepts an URL from the command line, parses the host, port, and URI components from the URL and then retrieves the document. Requires the following classes","author":"","date":"August 24, 2015","format":false,"excerpt":"UrlRetriever.java\u00a0 Accepts an URL from the command line, parses the host, port, and URI components from the URL and then retrieves the document. Requires the following classes: import java.util.*; \/** This parses the input to get a host, port, and file, then \u00a0*\u00a0 passes these three values to the UriRetriever\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26591,"url":"http:\/\/bangla.sitestree.com\/?p=26591","url_meta":{"origin":26597,"position":2},"title":"UrlRetriever.java  Accepts an URL from the command line, parses the host, port, and URI components from the URL and then retrieves the document. Requires the following classes: #Programming Code Examples #Java\/J2EE\/J2ME #Network Programming","author":"Author-Check- Article-or-Video","date":"April 29, 2021","format":false,"excerpt":"UrlRetriever.java Accepts an URL from the command line, parses the host, port, and URI components from the URL and then retrieves the document. Requires the following classes: import java.util.*; \/** This parses the input to get a host, port, and file, then * passes these three values to the UriRetriever\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26589,"url":"http:\/\/bangla.sitestree.com\/?p=26589","url_meta":{"origin":26597,"position":3},"title":"AddressVerifier.java  Connects to an SMTP server and issues a expn request to display details about a mailbox on the server. Uses the following classes: #Programming Code Examples #Java\/J2EE\/J2ME #Network Programming","author":"Author-Check- Article-or-Video","date":"April 29, 2021","format":false,"excerpt":"AddressVerifier.java Connects to an SMTP server and issues a expn request to display details about a mailbox on the server. Uses the following classes: import java.net.*; import java.io.*; \/** Given an e-mail address of the form user@host, * connect to port 25 of the host and issue an * 'expn'\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10189,"url":"http:\/\/bangla.sitestree.com\/?p=10189","url_meta":{"origin":26597,"position":4},"title":"AddressVerifier.java Connects to an SMTP server and issues a expn request to display details about a mailbox on the server. Uses the following classes","author":"","date":"August 24, 2015","format":false,"excerpt":"import java.net.*; import java.io.*; \/** Given an e-mail address of the form user@host, \u00a0*\u00a0 connect to port 25 of the host and issue an \u00a0*\u00a0 'expn' request for the user. Print the results. \u00a0* \u00a0*\u00a0 Taken from Core Web Programming from \u00a0*\u00a0 Prentice Hall and Sun Microsystems Press, \u00a0*\u00a0 .\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26743,"url":"http:\/\/bangla.sitestree.com\/?p=26743","url_meta":{"origin":26597,"position":5},"title":"ThreadedEchoServer.java  A multithreaded version of EchoServer, where each client request is serviced on a separate thread. Requires the following classes: #Programming Code Examples #Java\/J2EE\/J2ME #Network Programming","author":"Author-Check- Article-or-Video","date":"April 30, 2021","format":false,"excerpt":"ThreadedEchoServer.java A multithreaded version of EchoServer, where each client request is serviced on a separate thread. Requires the following classes: import java.net.*; import java.io.*; \/** A multithreaded variation of EchoServer. * * Taken from Core Web Programming from * Prentice Hall and Sun Microsystems Press, * . * \u00a9 2001\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=26597"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26597\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26597"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}