Strange numbers in java socket output

Posted by user293163 on Stack Overflow See other posts from Stack Overflow or by user293163
Published on 2010-03-13T22:14:48Z Indexed on 2010/03/13 22:25 UTC
Read the original article Hit count: 205

Filed under:
|

I have small test app:

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);
}

It`s output:

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 &#151; 94.103.87.153     </div>
</body>
</html>

0

Whence these numbers (123 an 0) takes?

© Stack Overflow or respective owner

Related posts about java

Related posts about sockets