FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [July 2012 Threads] Regarding Netconn API sample example for atmePosted by Anurag on July 5, 2012 Dear Sir
Is their any example for support Netconn API sample like echo server or webserver for Atmel microcontroller AT91SAM9XE-EK.i have done changes example as per LwIP TCP/IP stack demonstration for STM32F2x7xx microcontrollers Application for echo using netconn API.code is compile and echo server is not running.please guide me How i can fixed this issue.
Sampple code is
Example of a TCP echoserver demo using the Netconn API From the application point of view, the Netconn API offers a simpler way for developing TCP/IP applications than the raw API. This is because it has a more intuitive sequential API. The following example shows a TCP echoserver demo developed with the Netconn API. It is an extract of the main.c file. int main(void) { ... /* configure Ethernet (GPIOs, clocks, MAC, DMA) */ ETH_BSP_Config(); /* Initilaize the LwIP stack */ LwIP_Init(); /* Initialize tcp echo server */ tcpecho_init(); ... /* Start scheduler */ vTaskStartScheduler(); /* We should never get here as control is now taken by the scheduler */ for( ;; ); }
void tcpecho_init(void) { sys_thread_new("tcpecho_thread", tcpecho_thread, NULL,\ DEFAULT_THREAD_STACKSIZE, TCPECHO_THREAD_PRIO); }
static void tcpecho_thread(void *arg) { struct netconn *conn, *newconn; err_t err; LWIP_UNUSED_ARG(arg); /* Create a new connection identifier. */ conn = netconn_new(NETCONN_TCP);
if (conn!=NULL) { /* Bind connection to well known port number 7. */ err = netconn_bind(conn, NULL, 7); 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; while ((buf = netconn_recv(newconn)) != NULL) { do { netbuf_data(buf, &data, &len); 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"); } }
RE: Regarding Netconn API sample example for atmePosted by Richard on July 5, 2012 Sorry - I cannot provide free support for other peoples code. Previous responses on questions regarding the Netconn API can be seen here. Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|