lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] about lwip socket() and connect()??


From: K.J. Mansley
Subject: Re: [lwip-users] about lwip socket() and connect()??
Date: 25 Aug 2004 08:47:58 +0100

On Wed, 2004-08-25 at 03:24, xcb wrote:
>       thank you for reply my question,i use lwip-1.0.0 that inclue ppp
> code,and ppp link go up correctly.then i use socket
> api(socket(),connect(),send()).
>       first connect() always return -1,track connect code,find
> "netif->flags" is not set to NETIF_FLAG_UP,so i add
> "netif_set_up(&pc->netif)" in sifup()(ppp.c line 1002) :
>
> int sifup(int pd)
> {
>     PPPControl *pc = &pppControl[pd];
>     int st = 1;
>     
>     if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
>         st = 0;
>         PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", pd));
>     } else {
>                 netif_remove(&pc->netif);
>                 if (netif_add(&pc->netif, &pc->addrs.our_ipaddr,
> &pc->addrs.netmask, &pc->addrs.his_ipaddr, (void *)pd, pppifNetifInit,
> ip_input)) {
>                         pc->if_up = 1;
>                         pc->errCode = PPPERR_NONE;
>                                 netif_set_up(&pc->netif);
> //////////////////////////////// i add the code
> 
>                         PPPDEBUG((LOG_DEBUG, "sifup: unit %d:
> linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode));
>                         if(pc->linkStatusCB)
>                                 pc->linkStatusCB(pc->linkStatusCtx,
> pc->errCode, &pc->addrs);
>                 } else {
>                 st = 0;
>                 PPPDEBUG((LOG_ERR, "sifup[%d]: netif_add failed\n",
> pd));
>                 }
>     }
> 
>     return st;
> }
> 
> 
> then connect() return 0,but server machine not accept immediately(i
> have test sever,no any problem),when execute send(),server machine can
> accept() and recv string. Is i add the code(netif_set_up(&pc->netif))
> neccessary???,help me to resolver it. thank you.
> 

Ok, starting to understand now.  I don't know much about the PPP code so
maybe someone else on the mailing list will be able to give you answers
about that, and whether or not that extra line of code is necessary: I
doubt that it is though, as it would seem to be a pretty fundamental
flaw that others would have encountered already.

My guess would be that lwIP is not being initialised properly.  Can you
show us the code fragment that you use to initialise lwIP?
contrib/ports/unix/proj/lib/unixlib.c is a good example of what is
necessary to initialise it, although I'm not sure if using PPP requires
something different.

Could one of the PPP developers help out here?

Thanks

Kieran

PS. Please send all replies to the mailing list, rather than to me
directly - there's a chance that others could find it useful too!





reply via email to

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