lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Re: TCP listen fucntion always return <=0


From: Oscar F
Subject: [lwip-users] Re: TCP listen fucntion always return <=0
Date: Fri, 18 Sep 2009 09:15:06 +0200

I have more problem, the other task dosen´t work, the task of example WEB in the board fail in the accept connection.
Maybe i only have to one task for listen? i don´t belive but...

maybe ican´t use this
#if (HTTP_USED == 1)
   /* Create the WEB server task.  This uses the lwIP RTOS abstraction layer.*/
   sys_thread_new( "WEB", vBasicWEBServer, ( void * ) NULL,
                   lwipBASIC_WEB_SERVER_STACK_SIZE,
                   lwipBASIC_WEB_SERVER_PRIORITY );
#endif

#if (TFTP_USED == 1)
   /* Create the TFTP server task.  This uses the lwIP RTOS abstraction layer.*/
   sys_thread_new( "TFTP", vBasicTFTPServer, ( void * ) NULL,
                   lwipBASIC_TFTP_SERVER_STACK_SIZE,
                   lwipBASIC_TFTP_SERVER_PRIORITY );
#endif

   /* Create the Protocol RTU server task.  This uses the lwIP RTOS abstraction layer.*/
      sys_thread_new( "P_RTU", vProtocolRTUServer, ( void * ) NULL,
                      lwipBASIC_P_RTU_SERVER_STACK_SIZE,
                      lwipBASIC_P_RTU_SERVER_PRIORITY );


should i create a task and not thread?
Thanks
Oscar

On Fri, Sep 18, 2009 at 8:54 AM, Oscar F <address@hidden> wrote:
hello, i´m testing my application in EVK1100, and always the listen function return error. Can anybody help me?

The code
//Create the NUM_SOCKET=8 connection to wait the accept
    for(i=0;i<NUM_SOCKET;i++)
    {
          //Create the 8 socket
        lSocket[i] = lwip_socket(AF_INET, SOCK_STREAM, 0);
        if (lSocket[i]<0)
         return;


          //Bind to this socket
          memset((char *)&sLocalAddr[i], 0, sizeof(sLocalAddr[i]));
        sLocalAddr[i].sin_family = AF_INET;
        sLocalAddr[i].sin_len = sizeof(sLocalAddr[i]);
        sLocalAddr[i].sin_addr.s_addr = htonl(INADDR_ANY); //MY LOCAL IP is 192.168.1.7 defined for me
        sLocalAddr[i].sin_port = PortConnection[i]; //Ports of the table are 1500, 1501,1502...


        if (lwip_bind(lSocket[i],(struct sockaddr *)&sLocalAddr[i], sizeof(sLocalAddr[i])) < 0)
         {
           //Error. Close the socket
           lwip_close(lSocket[i]);
         }

        //Listen to the 8 socket.Maximum 10 connection for socket
        if ( lwip_listen(lSocket[i],10) != 0 )
         {
           lwip_close(lSocket[i]); //Always enter here
         }
      }

I don´t know the listen function fail. then i´ve using select to accept the connection

Thanks
Oscar


reply via email to

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