lwip-users
[Top][All Lists]
Advanced

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

RE: RE : [lwip-users] netconn_connct returning always ERR_OK


From: Marko Panger
Subject: RE: RE : [lwip-users] netconn_connct returning always ERR_OK
Date: Mon, 21 Jan 2008 10:08:17 +0100
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Hi again,

I'm still unable to reproduce the proper behavior or the behavior as Frédéric described below. The point is still that netconn_connect() returns ERR_OK even if there is nobody listening on the other side.

I've tried to debug the code a little bit and found that netconn_connect() returns ERR_OK even BEFORE the SYN packet is being sent out by ip_output() which is pretty strange. I'm also quite sure it must be me doing something wrong or there is a bad setting in the lwipopts.h file leading in the faulty behavior.

If someone has some experience any comment would help.

Thanks,
marko

-------- Original Message --------
Subject:        RE: RE : [lwip-users] netconn_connct returning always ERR_OK
Date:   Thu, 17 Jan 2008 00:11:14 +0100
From:   Marko Panger <address@hidden>
Reply-To:       Mailing list for lwIP users <address@hidden>
To:     Mailing list for lwIP users <address@hidden>
References: <address@hidden> <address@hidden> <address@hidden>



Hi,

I've upgraded to the last CVS HEAD and it still doesn't work for me. I've tried to dig into the code but I easy lost the track down the stack.

If you can instruct me at what to look or what to check I can do it.

However maybe is related to the fact I'm running the SLIP interface and maybe it has something to do with a race condition with the conn->err variable in the netconn_connect() function due to the setting of task priorities. Off course I might be totally wrong.

Btw. how should be task priorities of the "tcpip_thread", "slipif_loop" and "my_application" tasks related ?

marko

Frédéric BERNON wrote:
I have test with this code (after tcpip_init_done is called):
static void
connect_thread(void *arg)
{ /* Connect to server */
  struct ip_addr server_ip;
  struct netconn* conn;
  IP4_ADDR(&server_ip, 192,168,0,1);
conn = netconn_new_with_proto_and_callback(NETCONN_TCP, 6, NULL);
  while(netconn_connect(conn, &server_ip, 4576) != ERR_OK)
    { printf("error connect\n");
      sys_msleep(100);
    }
   printf("retry connected?\n");
   sys_msleep(-1);
}
When I execute this code, after some seconds, I got lot of "error connect", showing the netconn_connect doesn't return ERR_OK. Note I'm not sure it is supported to retry to call netconn_connect once you got an error. Perhaps you could test your code with last CVS HEAD ? ----- Original Message ----- From: "Marko Panger" <address@hidden <mailto:address@hidden>> To: "Mailing list for lwIP users" <address@hidden <mailto:address@hidden>>
Sent: Tuesday, January 15, 2008 2:27 PM
Subject: Re: RE : [lwip-users] netconn_connct returning always ERR_OK

> Hi Frédéric,
>
> I'm sorry but I really don't know how to determine the version. Is it
> from the CVS head. I'm attaching a snippet from the changelog file:
>
> HISTORY
>
> (CVS HEAD)
>
>  * [Enter new changes just after this line - do not remove this line]
>
>  ++ New features:
>
>  2007-09-15 Frédéric Bernon
>  * udp.h, udp.c, sockets.c: Changes for "#20503 IGMP Improvement". Add
> IP_MULTICAST_IF
>    option in socket API, and a new field "multicast_ip" in "struct
> udp_pcb" (for
>    netconn and raw API users), only if LWIP_IGMP=1. Add getsockopt
> processing for
>    IP_MULTICAST_TTL and IP_MULTICAST_IF.
>
> marko
>
> Frédéric BERNON wrote:
>> Which lwIP release do you use ?
>>
>> >> >> ====================================
>> Frédéric BERNON
>> HYMATOM SA
>> Chef de projet informatique
>> Microsoft Certified Professional
>> Tél. : +33 (0)4-67-87-61-10
>> Fax. : +33 (0)4-67-70-85-44
>> Email : address@hidden <mailto:address@hidden>
>> Web Site : http://www.hymatom.fr
>> ====================================
>> P Avant d'imprimer, penser à l'environnement
>> >>
>>
>> -----Message d'origine-----
>> De : address@hidden <mailto:address@hidden> [mailto:address@hidden De la part de Marko Panger
>> Envoyé : mardi 15 janvier 2008 13:12
>> À : Mailing list for lwIP users
>> Objet : [lwip-users] netconn_connct returning always ERR_OK
>>
>>
>> Hi all,
>>
>> I'm writing a client app. which connects to a remote server. I'm running
>> lwip under an rtos with
>>
>> #define NO_SYS 0
>>
>> I'm using the netconn sequential api and there is something about the
>> netconn_connect() call which is confusing me.
>> If I try to connect to a non-existing server (nobody is listening on
>> that ip on that port) the call still returns with ERR_OK.
>>
>> Shouldn't be some other error code ?
>>
>> In general how do I know that the other side has received the data send
>> by the client with netconn_write() ?
>>
>> Please find attached the code snipped below for reference.
>>
>> Thanks in advance for your help and comments,
>> marko
>>
>>     IP4_ADDR(&local_ip, 192, 168, 3, 2);
>>     IP4_ADDR(&net_mask, 255, 255, 255, 0);
>>     IP4_ADDR(&gateway, 192, 168, 3, 1);
>>     IP4_ADDR(&server_ip, 192, 168, 3, 1);
>> >> netif_add(&slip_if, &local_ip, &net_mask, &gateway, NULL, >> slipif_init, tcpip_input); >> netif_set_default(&slip_if);
>>     netif_set_up(&slip_if);
>> >> >> /* Connect to server */
>>     conn = netconn_new_with_proto_and_callback(NETCONN_TCP, 6,
>> server_conn_clb); >> >> while(netconn_connect(conn, &server_ip, RVA_PORT) != ERR_OK)
>>         TSK_Sleep(100);
>>
>>     while(1) {
>>         while(!(buf = netconn_recv(conn)))
>>             TSK_Sleep(10);
>> >> netbuf_data(buf, (void*)&p, &len); >> >> payload_len = *p++; >> /* Ping */
>>         switch(*p) {
>>             case 6:
>>                 netconn_write(conn, p-1, len, true);
>>                 netbuf_delete(buf);
>>                 break;
>>         }
>> >> }
>>
>>
>>
>>
>> _______________________________________________
>> lwip-users mailing list
>> address@hidden <mailto:address@hidden> http://lists.nongnu.org/mailman/listinfo/lwip-users >> >> _______________________________________________
>> lwip-users mailing list
>> address@hidden <mailto:address@hidden>
>> http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden <mailto:address@hidden>
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>

__________ NOD32 2798 (20080116) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com
------------------------------------------------------------------------

_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users


__________ NOD32 2798 (20080116) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com





reply via email to

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