lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] tcp_write() problem from outside callbacks functions


From: Yann Suisini
Subject: [lwip-users] tcp_write() problem from outside callbacks functions
Date: Thu, 5 Apr 2007 09:57:26 +0000

Hi,

I'm using lwip on a keil MBC2300 (thanks for the lwipweb in the files section ), but i'm facing to a strange trouble .
I can send/receive data with no trouble from the callback functions (the raw api is used), but when I want to send data from the main loop for exemple , I get a -6 error (ERR_CON: not connected) at each tcp_write.

here's a part of the source code :

while (1)
{
  if ((TickCounter-counter)>100)
  {
     counter=TickCounter;
     if (FlagActive) BLINK_RED_LED;
     else BLINK_BOTH_LED;
     if  ((i=tcp_write(tcpweb,&kikoo,sizeof(kikoo),0))!=ERR_OK)
     {
     debug_printf("TCP WRITE ERROR : %d:\r\n",i);
     }
     ParsePacket();
     SendTxPacket();
     CheckVoltage();

     ethernetif_handlepackets(netif_eth0);
     if (clock() - last_arp_time == ETHARP_TMR_INTERVAL * CLOCK_MS)
    {
        etharp_tmr();
        last_arp_time = clock();
    }
     if (clock() - last_tcpfast_time == TCP_FAST_INTERVAL * CLOCK_MS)
        {
         last_tcpfast_time = clock();
         tcp_fasttmr();           
    }

      if (clock() - last_tcpslow_time == TCP_SLOW_INTERVAL * CLOCK_MS)
    {
         last_tcpslow_time = clock();
         tcp_slowtmr();           
    }


The main loop is doing some calls to specific apps functions, led blinking every second , and call to the lwip stack polls functions.

At the first tcp_write , it's right that I'm not connected soe ERR_CON is ok . But even when I'm connected after, the ERR_CON is always returned . I really don't know what I'm doing wrong. It looks like the 
state of the connection is not known/updated in the the main function , just callbacks functions :(

Someone has a idea ?

Thanks in advance !


Exprimez-vous en direct avec Windows Live Messenger ! Windows Live Messenger !
reply via email to

[Prev in Thread] Current Thread [Next in Thread]