Regarding Netconn API sample example for atme

gupta123 wrote on Thursday, July 05, 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”);
}
}

rtel wrote on Thursday, July 05, 2012:

Sorry - I cannot provide free support for other peoples code.

Previous responses on questions regarding the Netconn API can be seen here.

Regards.