首页 新闻 会员 周边 捐助

WebSocket 客户端发送的消息到服务端被分段了

0
悬赏园豆:10 [待解决问题]

场景是客户端发送了一段很长的字符串,但是服务端接收的时候被分段了,这里是哪里有对消息长度做控制吗?前面做测试的时候没有关注消息的长度问题,今天去找了条正式的数据格式做测试,发现被分段接收了。
还是我需要对缓存区做设置?有相关的同学知道是哪里的问题吗?

这是客户端代码:

View Code

这是服务端代码:

View Code
1 2023-03-27 14:46:45.5469  INFO | ExecutionContext.RunInternal => Task.Execute => SynchronizationHelper.SafeWrapCallback | {"place":"车间","datatype":"HGZXT","username":"name","data":[{"serialno":"3270327520","sertype":"Y"},{"serialno":"3270327521","sertype":"Y"},{"serialno":"3270327522","sertype":"Y"},{"serialno":"3270327523","sertype":"Y"},{"serialno":"3270327524","sertype":"Y"},{"serialno":"3270327525","sertype":"Y"},{"serialno":"3270327526","sertype":"Y"},{"serialno":"3270327527","sertype":"Y"},{"serialno":"3270327528","sertype":"Y"},{"serialno":"3270327529","sertype":"Y"},{"serialno":"3270327530","sertype":"Y"},{"serialno":"3270327531","sertype":"Y"},{"serialno":"3270327532","sertype":"Y"},{"serialno":"3270327533","sertype":"Y"},{"serialno":"3270327534","sertype":"Y"},{"serialno":"3270327535","sertype":"Y"},{"serialno":"3270327536","sertype":"Y"},{"serialno":"3270327537","sertype":"Y"},{"serialno":"3270327538","sertype":"Y"},{"serialno":"3270327539","sertype":"Y"},{"serialno":"3270327540","sertype":"Y"},{"serialno":"3270327541","sertype":"Y"},{"serialno":"3270327542","sertype":"Y"},{"serialno":"3270327543","sertype":"Y"},{"serialno":"3270327544","sertype":"Y"},{"serialno":"3270327545","sertype":"Y"},{"serialno":"3270327546","sertype":"Y"},{"serialno":"3270327547","sertype":"Y"},{"serialno":"3270327548","sertype":"Y"},{"serialno":"3270327549","sertype":"Y"},{"serialno":"3270327550","sertype":"Y"},{"serialno":"3270327551","sertype":"Y"},{"seria|
2 2023-03-27 14:46:45.5469  INFO | ExecutionContext.RunInternal => Task.Execute => SynchronizationHelper.SafeWrapCallback | lno":"3270327552","sertype":"Y"},{"serialno":"3270327553","sertype":"Y"},{"serialno":"3270327554","sertype":"Y"},{"serialno":"3270327555","sertype":"Y"},{"serialno":"3270327556","sertype":"Y"},{"serialno":"3270327557","sertype":"Y"},{"serialno":"3270327558","sertype":"Y"},{"serialno":"3270327559","sertype":"Y"},{"serialno":"3270327560","sertype":"Y"},{"serialno":"3270327561","sertype":"Y"},{"serialno":"3270327562","sertype":"Y"},{"serialno":"3270327563","sertype":"Y"},{"serialno":"3270327564","sertype":"Y"},{"serialno":"3270327565","sertype":"Y"},{"serialno":"3270327566","sertype":"Y"},{"serialno":"3270327567","sertype":"Y"},{"serialno":"3270327568","sertype":"Y"},{"serialno":"3270327569","sertype":"Y"},{"serialno":"3270327570","sertype":"Y"},{"serialno":"3270327571","sertype":"Y"},{"serialno":"3270327572","sertype":"Y"},{"serialno":"3270327573","sertype":"Y"},{"serialno":"3270327574","sertype":"Y"},{"serialno":"3270327575","sertype":"Y"},{"serialno":"3270327576","sertype":"Y"},{"serialno":"3270327577","sertype":"Y"},{"serialno":"3270327578","sertype":"Y"},{"serialno":"3270327579","sertype":"Y"},{"serialno":"3270327580","sertype":"Y"},{"serialno":"3270327581","sertype":"Y"},{"serialno":"3270327582","sertype":"Y"},{"serialno":"3270327583","sertype":"Y"},{"serialno":"3270327584","sertype":"Y"},{"serialno":"3270327585","sertype":"Y"},{"serialno":"3270|
3 2023-03-27 14:46:45.5617  INFO | ExecutionContext.RunInternal => Task.Execute => SynchronizationHelper.SafeWrapCallback | 327586","sertype":"Y"},{"serialno":"3270327587","sertype":"Y"},{"serialno":"3270327588","sertype":"Y"},{"serialno":"3270327589","sertype":"Y"},{"serialno":"3270327590","sertype":"Y"},{"serialno":"3270327591","sertype":"Y"},{"serialno":"3270327592","sertype":"Y"},{"serialno":"3270327593","sertype":"Y"},{"serialno":"3270327594","sertype":"Y"},{"serialno":"3270327595","sertype":"Y"},{"serialno":"3270327596","sertype":"Y"},{"serialno":"3270327597","sertype":"Y"},{"serialno":"3270327598","sertype":"Y"},{"serialno":"3270327599","sertype":"Y"}]}|
消息日志
Vincent8464的主页 Vincent8464 | 初学一级 | 园豆:17
提问于:2023-03-27 16:30
< >
分享
所有回答(1)
0

while的作用是啥。。。

LiveCoding | 园豆:502 (小虾三级) | 2023-04-06 14:44
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册