Hi. I use lpc1769 custom board and MCUxpresso.
I need to convert Lwip_tcpecho_sa server application to client application or get new lwip client echo application.
Is there any lwip client application.
How can ı do ?
Hi. I use lpc1769 custom board and MCUxpresso.
I need to convert Lwip_tcpecho_sa server application to client application or get new lwip client echo application.
Is there any lwip client application.
How can ı do ?
I changed echo_init(); function with tcp_echoclient_connect();
now ı can send data to server but cant get data from server. When ı send data from hercules (server application), hercules shutdown.
When client connect to hercules(server),client count i set -1 and if ı reset my board, this number increse to -2 -3 -4 ....
How can ı get data from server ? What is other problems ?
void tcp_echoclient_connect(void)
{
struct ip_addr DestIPaddr;
/* create new tcp pcb */
echoclient_pcb = tcp_new();
if (echoclient_pcb != NULL)
{
IP4_ADDR( &DestIPaddr, DEST_IP_ADDR0, DEST_IP_ADDR1, DEST_IP_ADDR2, DEST_IP_ADDR3 );
/* connect to destination address/port */
tcp_connect(echoclient_pcb,&DestIPaddr,DEST_PORT,tcp_echoclient_connected);
}
else
{
/* deallocate the pcb */
memp_free(MEMP_TCP_PCB, echoclient_pcb);
#ifdef SERIAL_DEBUG
printf("\n\r can not create tcp pcb");
#endif
}
}
ADD FOR CLIENT THIS CODES TO ECHO.C IN LPCOPEN LWIP_TCPECHO_SA EXAMPLE
void tcp_echoclient_connect(void)
{
struct ip_addr DestIPaddr;if (echo_pcb != NULL)
{
IP4_ADDR( &DestIPaddr, 192, 168, 1, 43 );/* connect to destination address/port */
tcp_connect(echo_pcb,&DestIPaddr,7,echo_accept);
}
else
{
/* deallocate the pcb */
memp_free(MEMP_TCP_PCB, echo_pcb);
// DEBUGOUT("\n\r can not create tcp pcb");}
}
void
echo_init(void)
{
echo_pcb = tcp_new();
if (echo_pcb != NULL)
{
err_t err;err = tcp_bind(echo_pcb, IP_ADDR_ANY, 7);
if (err == ERR_OK)
{
// FOR SERVER
// echo_pcb = tcp_listen(echo_pcb);
// tcp_accept(echo_pcb, echo_accept);
// FOR CLİENT
tcp_echoclient_connect();
}
else
{
/* abort? output diagnostic? */
}
}
else
{
/* abort? output diagnostic? */
}
}
Hi Ramazan,
At code level there's not much differences between a client and server application, usually the first one that make the connection is considered a client.
So you could base your application in the lwip_tcpecho_sa/freertos.
Best Regards,
Alexis Andlaon