-
Notifications
You must be signed in to change notification settings - Fork 17
数据包超长得情况下丢包有问题 #3
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
Comments
是的,如果包长太长,会继续遍历完整个包;
但是这里不能直接丢包,如果当前正在处理的数据包含了下一包的包头,就是沾包的情况,直接return下一包会被丢掉;
能跳过肯定是最好的,但是也不知道跳过多少才对,万一跳过下一包的包头,干脆还是遍历一下,影响不大
…------------------ 原始邮件 ------------------
发件人: "aeo123/upacker" ***@***.***>;
发送时间: 2021年3月13日(星期六) 下午5:42
***@***.***>;
***@***.***>;
主题: [aeo123/upacker] 数据包超长得情况下丢包有问题 (#3)
else if (packer->state == 2)
{
//长度信息
packer->flen |= (uint16_t)d << 8;
packer->calc ^= d & 0x3F;
//数据包超长得情况下直接丢包 if ((packer->flen & 0x3FFF) > MAX_PACK_SIZE) { packer->state = 0; } packer->state = 3; packer->cnt = 0; }
问题:
当数据包超长时并不会直接丢包因为底下又重新给 state 赋值导致state = 0被覆盖。
解决方法:
在 packer->state = 0; 的下一行直接return 0;您看这样改是否妥当。
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
最后怎么解决的啊?我也发现特别长以后丢包 |
数据报不到4 k 就经常有 传输不到的数据包 |
如果是数据丢包,考虑下串口硬件和bsp得问题
…------------------ 原始邮件 ------------------
发件人: ***@***.***>;
发送时间: 2021年8月5日(星期四) 下午4:33
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [aeo123/upacker] 数据包超长得情况下丢包有问题 (#3)
数据报不到4 k 就经常有 传输不到的数据包
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
短包发送每个都可以,长包一旦出问题 ,后面短包也会出问题 ,我用的市QT 与RT thread系统的设备通讯 |
小于1k的数据没啥问题 大了以后汇有概率的接收不到 我用的cjson字符串传输 |
MAX_PACK_SIZE你设置的是多大?
发件人: hcb900330
发送时间: 2021-08-05 17:19
收件人: aeo123/upacker
抄送: Sunxiaowei123370; Author
主题: Re: [aeo123/upacker] 数据包超长得情况下丢包有问题 (#3)
小于1k的数据没啥问题 大了以后汇有概率的接收不到 我用的cjson字符串传输
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
1k到8k都有使用。最近用的是4k,我一般是配合dma来收发处理,在stm32和esp32上面使用
…------------------ 原始邮件 ------------------
发件人: ***@***.***>;
发送时间: 2021年8月6日(星期五) 上午10:56
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [aeo123/upacker] 数据包超长得情况下丢包有问题 (#3)
MAX_PACK_SIZE你设置的是多大?
发件人: hcb900330
发送时间: 2021-08-05 17:19
收件人: aeo123/upacker
抄送: Sunxiaowei123370; Author
主题: Re: [aeo123/upacker] 数据包超长得情况下丢包有问题 (#3)
小于1k的数据没啥问题 大了以后汇有概率的接收不到 我用的cjson字符串传输
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
软件包里面有一个宏,默认是1K,这个你有没有改
发件人: aeo123
发送时间: 2021-08-06 10:59
收件人: aeo123/upacker
抄送: Sunxiaowei123370; Author
主题: Re: [aeo123/upacker] 数据包超长得情况下丢包有问题 (#3)
1k到8k都有使用。最近用的是4k,我一般是配合dma来收发处理,在stm32和esp32上面使用
…------------------ 原始邮件 ------------------
发件人: ***@***.***>;
发送时间: 2021年8月6日(星期五) 上午10:56
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [aeo123/upacker] 数据包超长得情况下丢包有问题 (#3)
MAX_PACK_SIZE你设置的是多大?
发件人: hcb900330
发送时间: 2021-08-05 17:19
收件人: aeo123/upacker
抄送: Sunxiaowei123370; Author
主题: Re: [aeo123/upacker] 数据包超长得情况下丢包有问题 (#3)
小于1k的数据没啥问题 大了以后汇有概率的接收不到 我用的cjson字符串传输
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
默认的最大的配置我改了16384 |
static int uart_dma_sample(int argc, char *argv[])
} |
/* 接收数据回调函数 */
} static void serial_thread_entry(void *parameter)
} |
static void handle_cb(uint8_t *d, uint16_t size) } |
//使用动态内存 #if USE_DYNAMIC_MEM #define MAX_PACK_SIZE 16384 //最长消息长度,最大可用14位即16384 |
最后把这个改大了 RT_SERIAL_RB_BUFSZ 1024*17 好像就好多了 |
那就是连续 发的包太长,超过了驱动的接收缓存了。确实加长就行
…------------------ 原始邮件 ------------------
发件人: ***@***.***>;
发送时间: 2021年8月9日(星期一) 上午9:26
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [aeo123/upacker] 数据包超长得情况下丢包有问题 (#3)
最后把这个改大了 RT_SERIAL_RB_BUFSZ 1024*17 好像就好多了
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
else if (packer->state == 2)
{
//长度信息
packer->flen |= (uint16_t)d << 8;
packer->calc ^= d & 0x3F;
问题:
当数据包超长时并不会直接丢包因为底下又重新给 state 赋值导致state = 0被覆盖。
解决方法:
在 packer->state = 0; 的下一行直接return 0;您看这样改是否妥当。
The text was updated successfully, but these errors were encountered: