cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 lwip tcp server error

ark2
Associate III

I was going to make a lwip tcp server that was implemented in cube mx on cube
I get an initialization error, but I can't see it on tube mx, but it worked, so I wanted to ask how I can fix this to get rid of the error

Please tell me how

The part where the error comes out

conn = netconn_new(NETCONN_TCP); -> error: 'NETCONN_COPY' undeclared

netconn_write(newconn, transmitmsg, msg_len, NETCONN_COPY); -> error: 'NETCONN_COPY' undeclared

------------

code

--------

struct netconn *conn, *newconn;

err_t err, accept_err;

struct netbuf *buf;

void *data;

u16_t len;

 

LWIP_UNUSED_ARG(argument);

 

//error

conn = netconn_new(NETCONN_TCP);

 

if (conn!=NULL)

{

// netconn_bind(conn, NULL, port num)

// 192.168.0.177

err = netconn_bind(conn, NULL, 5001);

if (err == ERR_OK)

{

netconn_listen(conn);

while (1)

{

accept_err = netconn_accept(conn, &newconn);

 

if (accept_err == ERR_OK)

{

while (netconn_recv(newconn, &buf) == ERR_OK)

{

do

{

netbuf_data(buf, &data, &len);

memcpy(receivemsg, data, len);

 

initQueue(queue_size);

 

enqueue(receivemsg, len);

 

send_msg(receivemsg, len, 0);

 

transmitmsg = procPacket();

 

msg_len = getsendPackSize();

 

send_msg(transmitmsg, msg_len, 1);

 

//error

netconn_write(newconn, transmitmsg, msg_len, NETCONN_COPY);

 

}

while (netbuf_next(buf) >= 0);

 

netbuf_delete(buf);

}

netconn_close(newconn);

netconn_delete(newconn);

}

 

osDelay(100);

}

}

else

{

netconn_delete(newconn);

}

}

 

 

0 REPLIES 0