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
net: ReadFromUDP Mangled Bytes #8881
Labels
Comments
Issue #8858 has been merged into this issue. |
Issue #8858 has been merged into this issue. |
Oops, I am sorry, I left the sample code in a FIXED state. Simply add a "go" directive in front of the call to udpcallbackfunc() go udpcallbackfunc(gconn, grxadd, glen, gbuf[0:glen]) instead of just the call to udpcallbackfunc( ). Then run the python program and watch it DIE! |
Racy? How to make a copy of the gbuf and pass that copy to the goroutine thus isolating the bytes and NOT mangling them. As has been stated, I have tried many different ways to un-race the code. For example: gtemp := gbuf[0:glen] go udpcallbackfunc(gconn, grxadd, glen, gtemp[0:]) Nope, the bytes are STILL mangled. No way to call a go routine with any combination of the bytes. Can you suggest a change to the code? Thx, md |
gtemp := gbuf[0:glen] does not make a copy of the underlying array. It just gives you a new slice referring to the same underlying array. See http://blog.golang.org/slices . |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by rpzrpzrpz:
Attachments:
The text was updated successfully, but these errors were encountered: