M
Mark
Hey all,
I am working on a Java programm that uses sockets to connect to an HTML
Server and get the source of a document and display the source in the
window. Like if you did View...Source in Internet Explorer at a web page.
I have:
Socket theSocket = new Socket(host, port);
Writer writer = new OutputStreamWriter( theSocket.getOutputStream(),
"8859_1");
InputStream raw = theSocket.getInputStream();
new InputStreamReader(theSocket.getInputStream());
BufferedReader reader = new BufferedReader(new
InputStreamReader(System.in));
And I've tried:
BufferedInputStream buffer = new BufferedInputStream(raw);
BufferedReader reader = new BufferedReader(new
InputStreamReader(theSocket.getInputStream() ) );
I am confused as to why this doesn't work!
System.out.println("Before writer");
writer.write("GET /~mkeisli/index.html HTTP/1.0 \r\n\r\n");
//writer.write("GET " + file + " HTTP/1.0 \r\n\r\n");
System.out.println("After writer");
I have this (I commented out the one and hardcoded a value in to make sure I
wasn't doing something wrong)
But it will do the before system out but NEVER makes it to the after!
Anyone have any idea what I'm doing wrong??
Thank you,
Mark
"Whenever you're called on to make up your mind, And you're hampered by not
having any, The simplest way to solve the dilemma you'll find, Is simply by
flipping a penny. No, not so that chance shall decide the affair, As you're
pasively standing there moping. But as soon as the penny is up in the air,
You'll suddenly know what you're hoping."
--Piet Hein
I am working on a Java programm that uses sockets to connect to an HTML
Server and get the source of a document and display the source in the
window. Like if you did View...Source in Internet Explorer at a web page.
I have:
Socket theSocket = new Socket(host, port);
Writer writer = new OutputStreamWriter( theSocket.getOutputStream(),
"8859_1");
InputStream raw = theSocket.getInputStream();
new InputStreamReader(theSocket.getInputStream());
BufferedReader reader = new BufferedReader(new
InputStreamReader(System.in));
And I've tried:
BufferedInputStream buffer = new BufferedInputStream(raw);
BufferedReader reader = new BufferedReader(new
InputStreamReader(theSocket.getInputStream() ) );
I am confused as to why this doesn't work!
System.out.println("Before writer");
writer.write("GET /~mkeisli/index.html HTTP/1.0 \r\n\r\n");
//writer.write("GET " + file + " HTTP/1.0 \r\n\r\n");
System.out.println("After writer");
I have this (I commented out the one and hardcoded a value in to make sure I
wasn't doing something wrong)
But it will do the before system out but NEVER makes it to the after!
Anyone have any idea what I'm doing wrong??
Thank you,
Mark
"Whenever you're called on to make up your mind, And you're hampered by not
having any, The simplest way to solve the dilemma you'll find, Is simply by
flipping a penny. No, not so that chance shall decide the affair, As you're
pasively standing there moping. But as soon as the penny is up in the air,
You'll suddenly know what you're hoping."
--Piet Hein