BASIC4MCU | 질문게시판 | lwip tcp server를 할때
페이지 정보
작성자 라칸 작성일2023-08-09 17:20 조회545회 댓글6건본문
cube mx에서 tcp server를 만들어서 동작시켰던걸
cube ide로 가져와서 하려는데 초기화 오류가 나오는데 cube mx에서는 되던거여서요
이거 어떻게 해결하면 되나요?
찾아보려고해도 어디에 어떻게 있는지 안나오고 cube mx에서도 못찾겠어서요
오류 부분
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);
conn = netconn_new(NETCONN_TCP);
if (conn!=NULL)
{
// netconn_bind(conn, NULL, port 번호)
// 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);
// 메시지 송신
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);
}
}
[/code]
댓글 6
조회수 545알토이드님의 댓글
알토이드 작성일
netconn_write(newconn, transmitmsg, msg_len, 1);
로 바꿔서 되는지 확인해주세요
라칸님의 댓글
라칸
netconn_write(newconn, transmitmsg, msg_len, 1);
로 바꾸면 오류가 사라지긴하는데
conn = netconn_new(NETCONN_TCP); -> error: 'NETCONN_COPY' undeclared
여기도 문제여서 동작을 시킬수가 없네요
알토이드님의 댓글
알토이드 작성일
error: 'NETCONN_TCP' undeclared 이겟죠?
conn = netconn_new(0);
라칸님의 댓글
라칸
/Debug/../Core/Src/main.c:722: undefined reference to `netconn_new'
C:/ST/STM32CubeIDE_1.10.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Users/OWNER/NNF_PROJECT/2022_OCM/project/iot_ces_optical communication/Debug/../Core/Src/main.c:731: undefined reference to `netconn_listen'
C:/ST/STM32CubeIDE_1.10.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Users/OWNER/NNF_PROJECT/2022_OCM/project/iot_ces_optical communication/Debug/../Core/Src/main.c:757: undefined reference to `netconn_write'
이렇게 되고 있습니다 ㅜㅜ
알토이드님의 댓글
알토이드 작성일
저는 사용해보지 않은 환경이라 다음 링크들어가셔서 따라해보시면 어떨까요
https://eteo.tistory.com/251
'다음 Middleware에서 LwIP를 Enable 한다.'
master님의 댓글
master 작성일
cubemx 버전 문제 아닐까요?
처음 만들 때 참고했던 구버전 예제와 최신 버전의 예제를 비교해보세요