出现的问题是:在whie循环中多次执行send_data()之后,sdk Terminal窗口中报错:
#define ERR_MEM -1 /* Out of memory error. */
#define ERR_CONN -13 /* Not connected. */
程序在ch27上修改,在主函数的while循环中执行以下语句:
while (1)
{
/* call tcp timer every 250ms */
if(TcpTmrFlag)
{
if(request_pcb->state == CLOSED || (request_pcb->state == SYN_SENT && request_pcb->nrtx == TCP_SYNMAXRTX))
{
request_pcb = tcp_new();
if (!request_pcb) {
xil_printf("txperf: Error creating PCB. Out of Memory\r\n");
return -1;
}
//ip_set_option(request_pcb, SOF_REUSEADDR);
err = tcp_connect(request_pcb, &ipaddress, port, tcp_connected_callback);
if (err != ERR_OK) {
xil_printf("txperf: tcp_connect returned error: %d\r\n", err);
return err;
}
}
tcp_tmr();
TcpTmrFlag = 0;
}
/*receive input packet from emac*/
xemacif_input(netif);
/* if connected to the server, start receive data from PL through axidma, then transmit the data to the PC software by TCP*/
if(tcp_client_connected)
{
send_data();
sleep(1);
}
}
以下是send_data()函数:send_data()函数主要就是tcp_write()和tcp_output()函数。
void send_data()
{
#if __arm__
int copy = 3;
#else
int copy = 0;
#endif
err_t err;
struct tcp_pcb *tpcb = connected_pcb;
err = tcp_write(tpcb, yuan, 15, copy);
if (err != ERR_OK) {
xil_printf("txperf: Error on tcp_write: %d\r\n", err);
connected_pcb = NULL;
return;
}
err = tcp_output(tpcb);
if (err != ERR_OK) {
xil_printf("txperf: Error on tcp_output: %d\r\n",err);
return;
}
}
共2条
1/1 1 跳转至页
tcp长时间传输数据出错
共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
【有奖活动】震撼来袭!这场直播将直击工程师的心灵! | |
“我想要一部加热台”活动,不花钱赢取开发好工具!活动开始了哦 | |
【有奖活动】伙伴们:您的“需求”解决了吗? | |
抽奖了,抽奖了,金升阳医疗电源 |
打赏帖 | |
---|---|
【换取手持数字示波器】+与同事对定时器输出相位可调PWM移相全桥控制分享被打赏50分 | |
【换取手持数字示波器】+LP-MSPM0L1306开发板试用体验+串口被打赏40分 | |
CC-RL编译器相关问题求助被打赏10分 | |
【换取手持数字示波器】+与同事对ESP-12开发调试经验分享被打赏50分 | |
【换取手持数字示波器】+同事tek示波器调试spi解析被打赏50分 | |
【换取手持数字示波器】+2.6寸墨水屏调试经验被打赏50分 | |
换取手持数字示波器+个人开关电源的设计经验被打赏50分 | |
【换取手持数字示波器】+【APT32F173测评】+URAT被打赏20分 | |
【换取手持数字示波器】CH32X035的定时器以及外部中断体验被打赏50分 | |
【换取手持数字示波器】CH32X035搭建开发环境(RISC-V)被打赏50分 |