Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot read a whole message #63

Closed
joyqat opened this issue Aug 21, 2017 · 3 comments
Closed

cannot read a whole message #63

joyqat opened this issue Aug 21, 2017 · 3 comments

Comments

@joyqat
Copy link

joyqat commented Aug 21, 2017

buf := make([]byte, 128)
for {
	n, err = s.Read(buf)
	if err != nil {
	    log.Fatal(err)
	}
	log.Printf("%q", buf[:n])
}

result of code above:
when receive "abcdef"
it will print
"a" and "bcdef"
always a single byte followed by reminded bytes.
what is the problem?

btw, I use windows 10 build1703, Go 1.8, VSPD 6.9(virtual serial port).

@Robin3D
Copy link

Robin3D commented Aug 24, 2017

Me too, I have the same problem

@paocalvi
Copy link

paocalvi commented Aug 24, 2017 via email

@joyqat joyqat closed this as completed Aug 24, 2017
@joyqat
Copy link
Author

joyqat commented Aug 24, 2017

thanks for your opinion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants