我有一个小测试应用程序:
Socket socket = new Socket("jeck.ru", 80);
PrintWriter pw = new PrintWriter(socket.getOutputStream(), false);
pw.println("GET /ip/ HTTP/1.1");
pw.println("Host: jeck.ru");
pw.println();
pw.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String str;
while ((str = rd.readLine()) != null) {
System.out.println(str);
}
它的输出:
HTTP/1.1 200 OK
Date: Sat, 13 Mar 2010 22:06:51 GMT
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=5
Server HTTP/1.1 200 OK
Date: Sat, 13 Mar 2010 22:06:51 GMT
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=5
Server: Apache
Cache-Control: max-age=0
Expires: Sat, 13 Mar 2010 22:06:51 GMT
123
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Ваш IP</title>
</head>
<body>
<div style='text-align: center; font: 32pt Verdana;margin-top: 300px'>
Ваш IP — 94.103.87.153 </div>
</body>
</html>
0
这些数字(123和0)是什么?