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

net.createServer 分片问题 #23

Open
nxycdl opened this issue Jan 15, 2020 · 0 comments
Open

net.createServer 分片问题 #23

nxycdl opened this issue Jan 15, 2020 · 0 comments

Comments

@nxycdl
Copy link

nxycdl commented Jan 15, 2020

你好。我看了你的写的文档,写的非常详细,想咨询一个问题。我按照文档弄了一个socket程序, 发现client 发过来的一条消息,内容比较小的时候没有问题,内容大的时候被服务器进行分片接收了,如下代码的YYYY被打印了多次,将这些接收到的数据要合并在一起就是client的原始消息, 想咨询下你又没有什么办法能把分片的socket请求合并在一起,然后执行dosomething() 方法。

const server = new net.createServer();

server.on('connection', (client) => {
    client.on('data', async (msg) => { //接收client发来的信息
        
          const data = msg.toString('utf-8')
          console.log("YYYY")
          console.log(data )
          console.log("xxxxx")
          dosomething();
    });
});
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

1 participant