having with the standard net package.
I want to read n bytes at a time of a socket. In this case 10 bytes of a
socket to google's webserver.
Full code: http://play.golang.org/p/zAQsO1x9rW
Running that I get:
Read: [72 84 84 80 47 49 46 48 32 50]
Read: [72 84 84 80 47 49 46 48 32 50]
Read: [72 84 84 80 47 49 46 48 32 50]
Read: [72 84 84 80 47 49 46 48 32 50]
Read: [72 84 84 80 47 49 46 48 32 50]
Read: [72 84 84 80 47 49 46 48 32 50]
...
Continuing on forever.Read: [72 84 84 80 47 49 46 48 32 50]
Read: [72 84 84 80 47 49 46 48 32 50]
Read: [72 84 84 80 47 49 46 48 32 50]
Read: [72 84 84 80 47 49 46 48 32 50]
Read: [72 84 84 80 47 49 46 48 32 50]
...
It appears buf is not changing for each iteration of the loop. The first 10
bytes of the server's response stays in the slice through each iteration of
the loop.
I've tried using bufio package to wrap it but the problem remains the same.
--