I download freertos for str192.
i try to program server/client program. I set that str912 is server. and pc is client.
After program start, data receive and send for 8 times. It’s ok.
But 9th data didn’t receive and send.
Why do you above circustance?
it didn’t run after data receive 8 times
it didn’t run after data receive 8 times
If you have written your own client/server program, then I’m afraid only you will be able to debug it, unless you can provide a lot more information and code and find somebody willing to spend the time to look at it.
Regards.
it didn’t run after data receive 8 times
Thank for reading a message.
I use freertos version 5.0.2 target board program following code for server 1. calling founction void vBasicWEBServer( void *pvParameters ) // basicweb.c
{
unsigned char pcMessageToExchange = “n init socketrn”; struct ip_addr xIpAddr, xNetMast, xGateway;
extern err_t ethernetif_init( struct netif *netif ); /* Parameters are not used – suppress compiler error. */
( void ) pvParameters; /* Create and configure the EMAC interface. */
IP4_ADDR( &xIpAddr, emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 );
IP4_ADDR( &xNetMast, emacNET_MASK0, emacNET_MASK1, emacNET_MASK2, emacNET_MASK3 );
IP4_ADDR( &xGateway, emacGATEWAY_ADDR0, emacGATEWAY_ADDR1, emacGATEWAY_ADDR2, emacGATEWAY_ADDR3 );
netif_add( &EMAC_if, &xIpAddr, &xNetMast, &xGateway, NULL, ethernetif_init, tcpip_input ); /* make it the default interface */
netif_set_default( &EMAC_if ); /* bring it up */
netif_set_up(&EMAC_if);
vSerialPutString( 0, pcMessageToExchange, strlen( pcMessageToExchange ) );
/* Initialize HTTP */
// httpd_init(); //kcs
kcs_server(); // kcs
/* Nothing else to do. No point hanging around. */
vTaskDelete( NULL );
} void kcs_server() // httpd.c
{
struct tcp_pcb *pcb; pcb = tcp_new();
tcp_bind(pcb, IP_ADDR_ANY,2000);
tcp_arg(pcb,NULL);
pcb = tcp_listen(pcb);
tcp_accept( pcb, helloworld_accept);
} void helloworld_accept( void *arg, struct tcp_pcb *pcb, err_t err) // kcs
{
int i,j; vSerialPutString( 0, “acceptrn”, 10 );
vSerialPutString( 0, “readrn”, 8 );
tcp_err(pcb,conn_err); // 2010.3.4 kim
tcp_recv(pcb, kcs_receive);
for(j = 0; j < 1; j++)
{
vSerialPutString( 0, “writern”, 9 );
tcp_write(pcb, GREETING, strlen(GREETING),1);
for( i = 0; i < 100;i++) ;
}
} err_t kcs_receive(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) // kcs
{
int i;
vSerialPutString( 0, “receivern”, 11);
if( p != NULL)
{
tcp_recved(pcb,p->tot_len); // add kcs 2010.3.4
vSerialPutString( 0, p->payload, p->tot_len );
err = tcp_write(pcb,p->payload,p->tot_len ,1);
}
else if( err == ERR_OK)
{
vSerialPutString( 0, “socket closern”, 16 );
tcp_close(pcb);
}
err = tcp_write(pcb,p->payload,p->len,1); } Above code run 8 times packet and ping reply, but don’t run 9 times. and ping don’t reply
why did it run?
I use freertos version 5.0.2 target board program following code for server 1. calling founction void vBasicWEBServer( void *pvParameters ) // basicweb.c
{
unsigned char pcMessageToExchange = “n init socketrn”; struct ip_addr xIpAddr, xNetMast, xGateway;
extern err_t ethernetif_init( struct netif *netif ); /* Parameters are not used – suppress compiler error. */
( void ) pvParameters; /* Create and configure the EMAC interface. */
IP4_ADDR( &xIpAddr, emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 );
IP4_ADDR( &xNetMast, emacNET_MASK0, emacNET_MASK1, emacNET_MASK2, emacNET_MASK3 );
IP4_ADDR( &xGateway, emacGATEWAY_ADDR0, emacGATEWAY_ADDR1, emacGATEWAY_ADDR2, emacGATEWAY_ADDR3 );
netif_add( &EMAC_if, &xIpAddr, &xNetMast, &xGateway, NULL, ethernetif_init, tcpip_input ); /* make it the default interface */
netif_set_default( &EMAC_if ); /* bring it up */
netif_set_up(&EMAC_if);
vSerialPutString( 0, pcMessageToExchange, strlen( pcMessageToExchange ) );
/* Initialize HTTP */
// httpd_init(); //kcs
kcs_server(); // kcs
/* Nothing else to do. No point hanging around. */
vTaskDelete( NULL );
} void kcs_server() // httpd.c
{
struct tcp_pcb *pcb; pcb = tcp_new();
tcp_bind(pcb, IP_ADDR_ANY,2000);
tcp_arg(pcb,NULL);
pcb = tcp_listen(pcb);
tcp_accept( pcb, helloworld_accept);
} void helloworld_accept( void *arg, struct tcp_pcb *pcb, err_t err) // kcs
{
int i,j; vSerialPutString( 0, “acceptrn”, 10 );
vSerialPutString( 0, “readrn”, 8 );
tcp_err(pcb,conn_err); // 2010.3.4 kim
tcp_recv(pcb, kcs_receive);
for(j = 0; j < 1; j++)
{
vSerialPutString( 0, “writern”, 9 );
tcp_write(pcb, GREETING, strlen(GREETING),1);
for( i = 0; i < 100;i++) ;
}
} err_t kcs_receive(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) // kcs
{
int i;
vSerialPutString( 0, “receivern”, 11);
if( p != NULL)
{
tcp_recved(pcb,p->tot_len); // add kcs 2010.3.4
vSerialPutString( 0, p->payload, p->tot_len );
err = tcp_write(pcb,p->payload,p->tot_len ,1);
}
else if( err == ERR_OK)
{
vSerialPutString( 0, “socket closern”, 16 );
tcp_close(pcb);
}
err = tcp_write(pcb,p->payload,p->len,1); } Above code run 8 times packet and ping reply, but don’t run 9 times. and ping don’t reply
why did it run?
it didn’t run after data receive 8 times
addtion I used lwip code.
Above code rewrite web server code.
Above code rewrite web server code.