SendReq - String sentence ="GET http" argv[0"...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import*; import*; class SendReq { c public static void main(String argv[]) throws Exception { String modifiedSentence; Socket clientSocket = new Socket(argv[0], 80); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: String sentence = "GET http://" + argv[0] + " HTTP/1.0\n\n"; System.out.println("Snd: " + sentence); System.out.println("Rcv: "); System.out.println(); S outToServer.writeBytes(sentence); System.out.println(); while( (modifiedSentence = inFromServer.readLine()) != null) System.out.println(modifiedSentence); System.out.println(); clientSocket.close(); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online