problem with netconn_accept

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with netconn_accept

shobhit saxena
hello everyone,
                    i am using arm e7t board with ecos cofig tool & my
target is to establish LWIP-TCP/IP over PPP & have communication
between a server and ARM kit(client).I am using the lwip_init()
function to establish PPP connection.I am using the following code for
establishing TCP/IP .
my problem is that the program is running fine till the line
"newconn=netconn_accept(conn);"
but its not accepting connection.Is there something wrong with my code?
Is there any function to check the ip address that is being used?


static void simple_prog(CYG_ADDRESS data)
{
cyg_io_handle_t handle1;
cyg_io_lookup( "/dev/ser0", &handle1);
lwip_init();
    printf("\nConnected PPP\n");
struct netconn *conn, *newconn;
err_t err;
struct ip_addr *addr;
unsigned short port;
conn = netconn_new(NETCONN_TCP);
    cyg_thread_delay(50);

int bind_result = netconn_bind(conn, NULL, 2506);
//int bind_result = netconn_bind(conn,"192.168.0.4",2506);
    cyg_thread_delay(50);
    printf("\nBind to port 2506: [%d]", bind_result);
int listen_result = netconn_listen(conn);
    cyg_thread_delay(50);
    printf("\nListening: [%d]\nPress any key to begin accepting.",
listen_result);
    getchar();
    cyg_thread_delay(100);
int netconn_peer_result;
netconn_peer_result = netconn_peer(conn,NULL, NULL);

    printf("\nEntering while loop");
while(1) {
        printf("\nInside while loop");

    // --FROM HERE THE PROBLEM STARTS--//

        newconn=netconn_accept(conn);
        cyg_thread_delay(50);
        printf("\nAccept: [%d]", newconn);
        if(newconn != NULL)
        {
                  struct netbuf *buf;
                  void *data;
                  u16_t len;
                        while((buf = netconn_recv(newconn)) != NULL)
            {
            do {
                  netbuf_data(buf, &data, &len);
                  err = netconn_write(newconn, data, len, NETCONN_COPY);
                    if(err != ERR_OK) {    }
               } while(netbuf_next(buf) >= 0);
            netbuf_delete(buf);
                  }
                    netconn_delete(newconn);
                }
     }
}



void cyg_user_start(void)
{
    cyg_thread_create(4, simple_prog, (cyg_addrword_t) 0, "serial",
                      (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);
    cyg_scheduler_start();
}


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: problem with netconn_accept

Kieran Mansley
On Thu, Feb 08, 2007 at 06:19:56AM -0500, shobhit saxena wrote:
> hello everyone,
>                    i am using arm e7t board with ecos cofig tool & my
> target is to establish LWIP-TCP/IP over PPP & have communication
> between a server and ARM kit(client).I am using the lwip_init()
> function to establish PPP connection.I am using the following code for
> establishing TCP/IP .
> my problem is that the program is running fine till the line
> "newconn=netconn_accept(conn);"
> but its not accepting connection.Is there something wrong with my code?

I haven't looked in detail but it sounds like the packets aren't
getting through to lwIP.  I'm afraid I don't know enough about the
board you're using to suggest how to debug it though.

Good luck,

Kieran


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

client-server arch. using lwip

TEJ-4
In reply to this post by shobhit saxena
hi
can i use the complete lwip for a client server acrh. even if my system is having full fledged TCP/IP code and network driver.
if yes then how to proceed with this design
just give me some example...
help needed very desparately

Thank you in advance


Here’s a new way to find what you're looking for - Yahoo! Answers
_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: problem with netconn_accept

clive-5
In reply to this post by Kieran Mansley
At 12:42 08/02/2007, you wrote:

>On Thu, Feb 08, 2007 at 06:19:56AM -0500, shobhit saxena wrote:
> > hello everyone,
> >                    i am using arm e7t board with ecos cofig tool & my
> > target is to establish LWIP-TCP/IP over PPP & have communication
> > between a server and ARM kit(client).I am using the lwip_init()
> > function to establish PPP connection.I am using the following code for
> > establishing TCP/IP .
> > my problem is that the program is running fine till the line
> > "newconn=netconn_accept(conn);"
> > but its not accepting connection.Is there something wrong with my code?
>
>I haven't looked in detail but it sounds like the packets aren't
>getting through to lwIP.  I'm afraid I don't know enough about the
>board you're using to suggest how to debug it though.

Might be an obvious question, but have you started up the network interface
over which you wish to pass data? You mentioned PPP, is it dial up or PPPoE
for example? You might be thinking that LwIP does this for you - it
doesn't. You need to establish the low level link you wish to use (e.g. if
dial up PPP, then start the modem connection) before trying to send any data.

Hope this helps,

CTW



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users