一个简单的java编程的问题,求高人。。。。。
import java.io.*;
import java.net.*;
public class ReadClient {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try
{
Socket clientSocket=new Socket("www.sina.com",80);
System.out.println("Client:"+clientSocket);
DataOutputStream outbound=new DataOutputStream(clientSocket.getOutputStream());
DataInputStream inbound=new DataInputStream(clientSocket.getInputStream());
InputStreamReader inS=new InputStreamReader(inbound);
File f=new File("sina.html");
FileOutputStream fOut=new FileOutputStream(f);
PrintStream p=new PrintStream(fOut);
outbound.writeBytes("GET /HTTP/1.0\r\n\r\n");
int c;
while((c=inS.read())!=-1)
p.print((char)c);
inS.close();
outbound.close();
inbound.close();
clientSocket.close();
}
catch(UnknownHostException uhe)
{
System.out.println("UnknowHostException:"+uhe);
}
catch(IOException ioe)
{
System.out.println("IOException:"+ioe);
}
}
}
这个是我写的一个java程序,目的是为了抓取www.sina.com首页的文本信息,然后写到本地的一个叫做sina.html的文件中,但是总是不成功,特别是对于里面outbound.writeBytes("GET /HTTP/1.0\r\n\r\n");这句话不是很理解,请教一下"GET /HTTP/1.0\r\n\r\n"到底是什么意思呢???谢谢啦!