Code Monkey home page Code Monkey logo

Comments (4)

luopeiyu avatar luopeiyu commented on July 17, 2024

你好呀,会不会是text组件高度太小,导致只够显示一行呢?

from unity_net_book.

CaigerDeng avatar CaigerDeng commented on July 17, 2024

还真不是,我Debug发现这里:
string s = System.Text.Encoding.UTF8.GetString(readBuff,2,buffCount);
转出来的s是有问题的,比如说输入hi(其实就是02hi),转出来的s.length常理来说是2,但其实是4,这就导致接下来对字符串s的打印、自加等操作可能都会有问题。

from unity_net_book.

luopeiyu avatar luopeiyu commented on July 17, 2024

明白了,此处确实有误。
原因在于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.

CaigerDeng avatar CaigerDeng commented on July 17, 2024

OK,谢谢解答

from unity_net_book.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.