{"id":10204,"date":"2015-08-25T07:46:16","date_gmt":"2015-08-25T11:46:16","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/?p=10204"},"modified":"2015-08-24T08:41:11","modified_gmt":"2015-08-24T12:41:11","slug":"threadedechoserver-java-a-multithreaded-version-of-echoserver-where-each-client-request-is-serviced-on-a-separate-thread-requires-the-following-classes","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=10204","title":{"rendered":"ThreadedEchoServer.java A multithreaded version of EchoServer, where each client request is serviced on a separate thread. Requires the following classes"},"content":{"rendered":"<pre>import java.net.*;\r\nimport java.io.*;\r\n\r\n\/** A multithreaded variation of EchoServer.\r\n\u00a0*\r\n\u00a0*\u00a0 Taken from Core Web Programming from\r\n\u00a0*\u00a0 Prentice Hall and Sun Microsystems Press,\r\n\u00a0*\u00a0 .\r\n\u00a0*\u00a0 \u00a9 2001 Marty Hall and Larry Brown;\r\n\u00a0*\u00a0 may be freely used or adapted.\r\n\u00a0*\/\r\n\r\npublic class ThreadedEchoServer extends EchoServer\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 implements Runnable {\r\n\u00a0 public static void main(String[] args) {\r\n\u00a0\u00a0\u00a0 int port = 8088;\r\n\u00a0\u00a0\u00a0 if (args.length &gt; 0) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 try {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 port = Integer.parseInt(args[0]);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 } catch(NumberFormatException nfe) {}\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0 ThreadedEchoServer echoServer =\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 new ThreadedEchoServer(port, 0);\r\n\u00a0\u00a0\u00a0 echoServer.serverName = \"Threaded EchoServer\";\r\n\u00a0 }\r\n\r\n\u00a0 public ThreadedEchoServer(int port, int connections) {\r\n\u00a0\u00a0\u00a0 super(port, connections);\r\n\u00a0 }\r\n\r\n\u00a0 \/** The new version of handleConnection starts a thread. This\r\n\u00a0\u00a0 *\u00a0 new thread will call back to the old version of\r\n\u00a0\u00a0 *\u00a0 handleConnection, resulting in the same server behavior\r\n\u00a0\u00a0 *\u00a0 in a multithreaded version. The thread stores the Socket\r\n\u00a0\u00a0 *\u00a0 instance since run doesn't take any arguments, and since\r\n\u00a0\u00a0 *\u00a0 storing the socket in an instance variable risks having\r\n\u00a0\u00a0 *\u00a0 it overwritten if the next thread starts before the run\r\n\u00a0\u00a0 *\u00a0 method gets a chance to copy the socket reference.\r\n\u00a0\u00a0 *\/\r\n\r\n\u00a0 public void handleConnection(Socket server) {\r\n\u00a0\u00a0\u00a0 Connection connectionThread = new Connection(this, server);\r\n\u00a0\u00a0\u00a0 connectionThread.start();\r\n\u00a0 }\r\n\r\n\u00a0 public void run() {\r\n\u00a0\u00a0\u00a0 Connection currentThread =\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 (Connection)Thread.currentThread();\r\n\u00a0\u00a0\u00a0 try {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 super.handleConnection(currentThread.getSocket());\r\n\u00a0\u00a0\u00a0 } catch(IOException ioe) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.println(\"IOException: \" + ioe);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 ioe.printStackTrace();\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0 }\r\n}\r\n\r\n\/** This is just a Thread with a field to store a Socket object.\r\n\u00a0*\u00a0 Used as a thread-safe means to pass the Socket from\r\n\u00a0*\u00a0 handleConnection to run.\r\n\u00a0*\/\r\n\r\nclass Connection extends Thread {\r\n\u00a0 private Socket serverSocket;\r\n\r\n\u00a0 public Connection(Runnable serverObject,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Socket serverSocket) {\r\n\u00a0\u00a0\u00a0 super(serverObject);\r\n\u00a0\u00a0\u00a0 this.serverSocket = serverSocket;\r\n\u00a0 }\r\n\r\n\u00a0 public Socket getSocket() {\r\n\u00a0\u00a0\u00a0 return serverSocket;\r\n\u00a0 }\r\n}\r\n\r\n\r\n\r\nEchoServer.java\u00a0 Creates a Web page showing all data sent from the client (browser). \r\n\r\n\r\nimport java.net.*;\r\nimport java.io.*;\r\nimport java.util.StringTokenizer;\r\n\r\n\/** A simple HTTP server that generates a Web page showing all\r\n\u00a0*\u00a0 of the data that it received from the Web client (usually\r\n\u00a0*\u00a0 a browser). To use this server, start it on the system of\r\n\u00a0*\u00a0 your choice, supplying a port number if you want something\r\n\u00a0*\u00a0 other than port 8088. Call this system server.com. Next,\r\n\u00a0*\u00a0 start a Web browser on the same or a different system, and\r\n\u00a0*\u00a0 connect to http:\/\/server.com:8088\/whatever. The resultant\r\n\u00a0*\u00a0 Web page will show the data that your browser sent. For \r\n\u00a0*\u00a0 debugging in servlet or CGI programming, specify \r\n\u00a0*\u00a0 http:\/\/server.com:8088\/whatever as the ACTION of your HTML\r\n\u00a0*\u00a0 form. You can send GET or POST data; either way, the\r\n\u00a0*\u00a0 resultant page will show what your browser sent.\r\n\u00a0*\r\n\u00a0*\u00a0 Taken from Core Web Programming from \r\n\u00a0*\u00a0 Prentice Hall and Sun Microsystems Press,\r\n\u00a0*\u00a0 \u00a9 2001 Marty Hall and Larry Brown;\r\n\u00a0*\u00a0 may be freely used or adapted. \r\n\u00a0*\/\r\n\r\npublic class EchoServer extends NetworkServer {\r\n\u00a0 protected int maxRequestLines = 50;\r\n\u00a0 protected String serverName = \"EchoServer\";\r\n\r\n\u00a0 \/** Supply a port number as a command-line\r\n\u00a0\u00a0 *\u00a0 argument. Otherwise, use port 8088.\r\n\u00a0\u00a0 *\/\r\n\u00a0 \r\n\u00a0 public static void main(String[] args) {\r\n\u00a0\u00a0\u00a0 int port = 8088;\r\n\u00a0\u00a0\u00a0 if (args.length &gt; 0) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 try {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 port = Integer.parseInt(args[0]);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 } catch(NumberFormatException nfe) {}\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0 new EchoServer(port, 0);\r\n\u00a0 }\r\n\r\n\u00a0 public EchoServer(int port, int maxConnections) {\r\n\u00a0\u00a0\u00a0 super(port, maxConnections);\r\n\u00a0\u00a0\u00a0 listen();\r\n\u00a0 }\r\n\r\n\u00a0 \/** Overrides the NetworkServer handleConnection method to \r\n\u00a0\u00a0 *\u00a0 read each line of data received, save it into an array\r\n\u00a0\u00a0 *\u00a0 of strings, then send it back embedded inside a PRE \r\n\u00a0\u00a0 *\u00a0 element in an HTML page.\r\n\u00a0\u00a0 *\/\r\n\u00a0 \r\n\u00a0 public void handleConnection(Socket server)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 throws IOException{\r\n\u00a0\u00a0\u00a0 System.out.println\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (serverName + \": got connection from \" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 server.getInetAddress().getHostName());\r\n\u00a0\u00a0\u00a0 BufferedReader in = SocketUtil.getReader(server);\r\n\u00a0\u00a0\u00a0 PrintWriter out = SocketUtil.getWriter(server);\r\n\u00a0\u00a0\u00a0 String[] inputLines = new String[maxRequestLines];\r\n\u00a0\u00a0\u00a0 int i;\r\n\u00a0\u00a0\u00a0 for (i=0; i\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"\u00a0 \\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"\r\n\" + serverName +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \" Results\r\n\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"Here is the request line and request headers\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"sent by your browser:\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"\r\n\r\n\");\r\n\u00a0 }\r\n\r\n\u00a0 \/\/ Print bottom of a standard Web page.\r\n\u00a0 \r\n\u00a0 private void printTrailer(PrintWriter out) {\r\n\u00a0\u00a0\u00a0 out.println\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 (\"\r\n\r\n\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"\\n\");\r\n\u00a0 }\r\n\r\n\u00a0 \/\/ Normal Web page requests use GET, so this server can simply\r\n\u00a0 \/\/ read a line at a time. However, HTML forms can also use \r\n\u00a0 \/\/ POST, in which case we have to determine the number of POST\r\n\u00a0 \/\/ bytes that are sent so we know how much extra data to read\r\n\u00a0 \/\/ after the standard HTTP headers.\r\n\u00a0 \r\n\u00a0 private boolean usingPost(String[] inputs) {\r\n\u00a0\u00a0\u00a0 return(inputs[0].toUpperCase().startsWith(\"POST\"));\r\n\u00a0 }\r\n\r\n\u00a0 private void readPostData(String[] inputs, int i,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 BufferedReader in)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 throws IOException {\r\n\u00a0\u00a0\u00a0 int contentLength = contentLength(inputs);\r\n\u00a0\u00a0\u00a0 char[] postData = new char[contentLength];\r\n\u00a0\u00a0\u00a0 in.read(postData, 0, contentLength);\r\n\u00a0\u00a0\u00a0 inputs[++i] = new String(postData, 0, contentLength);\r\n\u00a0 }\r\n\r\n\u00a0 \/\/ Given a line that starts with Content-Length,\r\n\u00a0 \/\/ this returns the integer value specified.\r\n\u00a0 \r\n\u00a0 private int contentLength(String[] inputs) {\r\n\u00a0\u00a0\u00a0 String input;\r\n\u00a0\u00a0\u00a0 for (int i=0; iOverride this method in servers\r\n\u00a0\u00a0 *\u00a0 you write.\r\n\u00a0\u00a0 * \u00a0\r\n\r\n\r\n\u00a0\u00a0 *\u00a0 This generic version simply reports the host that made\r\n\u00a0\u00a0 *\u00a0 the connection, shows the first line the client sent,\r\n\u00a0\u00a0 *\u00a0 and sends a single line in response.\r\n\u00a0\u00a0 *\/\r\n\r\n\u00a0 protected void handleConnection(Socket server)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 throws IOException{\r\n\u00a0\u00a0\u00a0 BufferedReader in = SocketUtil.getReader(server);\r\n\u00a0\u00a0\u00a0 PrintWriter out = SocketUtil.getWriter(server);\r\n\u00a0\u00a0\u00a0 System.out.println\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 (\"Generic Network Server: got connection from \" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 server.getInetAddress().getHostName() + \"\\n\" +\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"with first line '\" + in.readLine() + \"'\");\r\n\u00a0\u00a0\u00a0 out.println(\"Generic Network Server\");\r\n\u00a0\u00a0\u00a0 server.close();\r\n\u00a0 }\r\n\r\n\u00a0 \/** Gets the max connections server will handle before\r\n\u00a0\u00a0 *\u00a0 exiting. A value of 0 indicates that server should run\r\n\u00a0\u00a0 *\u00a0 until explicitly killed.\r\n\u00a0\u00a0 *\/\r\n\r\n\u00a0 public int getMaxConnections() {\r\n\u00a0\u00a0\u00a0 return(maxConnections);\r\n\u00a0 }\r\n\r\n\u00a0 \/** Sets max connections. A value of 0 indicates that server\r\n\u00a0\u00a0 *\u00a0 should run indefinitely (until explicitly killed).\r\n\u00a0\u00a0 *\/\r\n\r\n\u00a0 public void setMaxConnections(int maxConnections) {\r\n\u00a0\u00a0\u00a0 this.maxConnections = maxConnections;\r\n\u00a0 }\r\n\r\n\u00a0 \/** Gets port on which server is listening. *\/\r\n\r\n\u00a0 public int getPort() {\r\n\u00a0\u00a0\u00a0 return(port);\r\n\u00a0 }\r\n\r\n\u00a0 \/** Sets port. You can only do before \"connect\" is\r\n\u00a0\u00a0 *\u00a0 called. That usually happens in the constructor.\r\n\u00a0\u00a0 *\/\r\n\r\n\u00a0 protected void setPort(int port) {\r\n\u00a0\u00a0\u00a0 this.port = port;\r\n\u00a0 }\r\n}\r\n\r\n\r\nSocketUtil.java\u00a0 Simplifies the creation of a PrintWriter and BufferedReader.\r\n\r\nimport java.net.*;\r\nimport java.io.*;\r\n\r\n\/** A shorthand way to create BufferedReaders and\r\n\u00a0*\u00a0 PrintWriters associated with a Socket.\r\n\u00a0*\r\n\u00a0*\u00a0 Taken from Core Web Programming from \r\n\u00a0*\u00a0 Prentice Hall and Sun Microsystems Press,\r\n\u00a0*\u00a0 \u00a9 2001 Marty Hall and Larry Brown;\r\n\u00a0*\u00a0 may be freely used or adapted. \r\n\u00a0*\/\r\n\r\npublic class SocketUtil {\r\n\u00a0 \/** Make a BufferedReader to get incoming data. *\/\r\n\r\n\u00a0 public static BufferedReader getReader(Socket s)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 throws IOException {\r\n\u00a0\u00a0\u00a0 return(new BufferedReader(\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new InputStreamReader(s.getInputStream())));\r\n\u00a0 }\r\n\r\n\u00a0 \/** Make a PrintWriter to send outgoing data.\r\n\u00a0\u00a0 *\u00a0 This PrintWriter will automatically flush stream\r\n\u00a0\u00a0 *\u00a0 when println is called.\r\n\u00a0\u00a0 *\/\r\n\r\n\u00a0 public static PrintWriter getWriter(Socket s)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 throws IOException {\r\n\u00a0\u00a0\u00a0 \/\/ Second argument of true means autoflush.\r\n\u00a0\u00a0\u00a0 return(new PrintWriter(s.getOutputStream(), true));\r\n\u00a0 }\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>import java.net.*; import java.io.*; \/** A multithreaded variation of EchoServer. \u00a0* \u00a0*\u00a0 Taken from Core Web Programming from \u00a0*\u00a0 Prentice Hall and Sun Microsystems Press, \u00a0*\u00a0 . \u00a0*\u00a0 \u00a9 2001 Marty Hall and Larry Brown; \u00a0*\u00a0 may be freely used or adapted. \u00a0*\/ public class ThreadedEchoServer extends EchoServer \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 implements Runnable { \u00a0 public static &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=10204\">Continue reading<\/a><\/p>\n","protected":false},"author":130,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1417,1424],"tags":[706,1319,308,1033,285],"class_list":["post-10204","post","type-post","status-publish","format-standard","hentry","category-code-programming-samples--","category-javaj2eej2me","tag-code","tag-echo","tag-java","tag-server","tag-285","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":26743,"url":"http:\/\/bangla.sitestree.com\/?p=26743","url_meta":{"origin":10204,"position":0},"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":[]},{"id":26591,"url":"http:\/\/bangla.sitestree.com\/?p=26591","url_meta":{"origin":10204,"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: #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":10192,"url":"http:\/\/bangla.sitestree.com\/?p=10192","url_meta":{"origin":10204,"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","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":26583,"url":"http:\/\/bangla.sitestree.com\/?p=26583","url_meta":{"origin":10204,"position":3},"title":"NetworkClientTest.java  Makes a simple connection to the host and port specified on the command line. 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":"NetworkClientTest.java Makes a simple connection to the host and port specified on the command line. Uses the following classes: \/** Make simple connection to host and port specified. * * Taken from Core Web Programming from * Prentice Hall and Sun Microsystems Press, * . * \u00a9 2001 Marty Hall\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":10196,"url":"http:\/\/bangla.sitestree.com\/?p=10196","url_meta":{"origin":10204,"position":4},"title":"UrlTest.java Demonstrates the ease in which the various components of an URL can be determined (host, port, protocol, etc.)","author":"","date":"August 25, 2015","format":false,"excerpt":"\u099c\u09be import java.net.*; \/** Read a URL from the command line, then print \u00a0*\u00a0 the various components. \u00a0* \u00a0*\u00a0 Taken from Core Web Programming from \u00a0*\u00a0 Prentice Hall and Sun Microsystems Press, \u00a0*\u00a0 . \u00a0*\u00a0 \u00a9 2001 Marty Hall and Larry Brown; \u00a0*\u00a0 may be freely used or adapted. \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":10183,"url":"http:\/\/bangla.sitestree.com\/?p=10183","url_meta":{"origin":10204,"position":5},"title":"NetworkClientTest.java Makes a simple connection to the host and port specified on the command line. Uses the following classes","author":"","date":"August 21, 2015","format":false,"excerpt":"NetworkClientTest.java\u00a0 Makes a simple connection to the host and port specified on the command line. Uses the following classes: \/** Make simple connection to host and port specified. \u00a0* \u00a0*\u00a0 Taken from Core Web Programming from \u00a0*\u00a0 Prentice Hall and Sun Microsystems Press, \u00a0*\u00a0 . \u00a0*\u00a0 \u00a9 2001 Marty Hall\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":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10204","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\/130"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10204"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10204\/revisions"}],"predecessor-version":[{"id":10205,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10204\/revisions\/10205"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10204"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}