java - SimpleClient - GET request -


I have received this training work in my school, which says: "Change the simple client" so that this GET request Archives the contents of a given address on the command line and the file's response to the disk.

  Import java.net. *; Import java.io * *; Public category SimpleClient {public static zero main (string [] args {try} socket cone = new socket (args [0], integer .Portset (args [1]); PrintStream Out = new printstream (con.getOutputStream ()); Out.print (args [2]); Out.write (0); // Mark at the end of the message. Flush (); InputStreamReader = new InputStreamReader (con.getInputStream ()); Int c; While ((c = in.read ())! = - 1) System.out.print ((four) C); con.close (); } Hold (IOException e) {System.err.println (e); }}   

As far as I want to make the "cone" example of the socket connection to the host via a port (www.google.com like ARG [0]) number (Args [ 1]) Then a printstream is made "out", but what is the function of the out. Print (AGR [2]) and outside Type (0)? I am not fully able to understand this program, so I appreciate if someone can explain this to me and it can tell how it should be changed to work. Opening a socket connection is not like filling a GET request

Take a look at / html>

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -