Comments (4)
你好呀,会不会是text组件高度太小,导致只够显示一行呢?
from unity_net_book.
还真不是,我Debug发现这里:
string s = System.Text.Encoding.UTF8.GetString(readBuff,2,buffCount);
转出来的s是有问题的,比如说输入hi(其实就是02hi),转出来的s.length常理来说是2,但其实是4,这就导致接下来对字符串s的打印、自加等操作可能都会有问题。
from unity_net_book.
明白了,此处确实有误。
原因在于string s = System.Text.Encoding.UTF8.GetString(readBuff,2,buffCount);这一句。此处应改为string s = System.Text.Encoding.UTF8.GetString(readBuff,2,bodyLength);
因为buffCount是整个缓冲区的长度,bodyLength才是某条消息的长度。
这个问题下一版印刷更正~
from unity_net_book.
OK,谢谢解答
from unity_net_book.
Related Issues (9)
- 第二版的出版时间及和第一版的差异? HOT 2
- 异步和多路复用应用场景问题? HOT 4
- 不知道是不是勘误 HOT 1
- 勘误+建议 HOT 1
- 第二版第8章的一些代码问题 HOT 1
- 勘误(?还是该叫补充...):3.4.5节 测试网络模块 HOT 1
- [建议]6.6测试OnMove提醒一下响声的原因
- 有错误
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unity_net_book.