CopyN with net.Conn oddness

Can someone explain why each character is taken as 3 bytes?

thanks

As Brad said in the issue, when you use telnet to connect to your server, because telnet is line buffered you have to press enter to send the data to the server. Telnet for historical reasons converts enter into \r\n so that’s your three characters.

You can prove this yourself. Wrap one side of c in a io.TeeReader, and send the output to a *bytes.Buffer. When CopyN is done, print out the bytes in the buffer with fmt.Printf ("%q\n", buf)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.