티스토리 뷰
- thread상에서 2개의 thread를 동시에 열고 netconn를 여러개 사용할수 없음
-> 하나의 스레드에서만 하거나, opt.h 파일 내에서 설정을 변경하여 SYS_LIGHTWEIGHT_PROT를 0으로 두어 알아서 제어하면 됨
- client 단을 만들때에는 delete를 했을때 제대로 delete가 안되는 문제가 있을수 있음
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | static void tcpecho_thread(void *arg) { struct netconn *conn, *newconn; err_t err, errWrite; LWIP_UNUSED_ARG(arg); /* Create a new connection identifier. */ conn = netconn_new(NETCONN_TCP); if (conn!=NULL) { /* Bind connection to well known port number 25262. */ err = netconn_bind(conn, NULL, RECV_PORT); if (err == ERR_OK) { /* Tell connection to go into listening mode. */ netconn_listen(conn); while (1) { /* Grab new connection. */ newconn = netconn_accept(conn); /* Process the new connection. */ if(newconn) { struct netbuf *buf; void *data; u16_t len; //LCD_LINE_Control(Line3, "Server Connected"); while((buf = netconn_recv(newconn)) != NULL) { do { netbuf_data(buf, &data, &len); errWrite = netconn_write(newconn, data, len, NETCONN_COPY); } while (netbuf_next(buf) >= 0); netbuf_delete(buf); } /* Close connection and discard connection identifier. */ netconn_close(newconn); netconn_delete(newconn); } } } else { printf(" can not bind TCP netconn"); } } else { printf("can not create TCP netconn"); } } | cs |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- xiaomi
- 샤오미 한글
- 블로그 코드
- lwIP
- 샤오미
- lsusb
- Stable
- Endpoint
- not valid yet
- sudo apt-get update
- ubuntu
- IROBOT
- roomba
- descriptor
- apt update
- raspberrypi4
- stm32f4
- STM32
- netconn
- apt-get update
- Raspberry
- 블로그 소스
- ubuntu opencv
- 라즈베리파이
- dashcam
- 샤오미 대쉬캠
- 블로그 소스코드
- blog source
- xiaomi Yi
- RaspberryPi
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
글 보관함
