Problem: new socket

acemax wrote on Tuesday, January 26, 2010:


I’m trying to implement the code below, but it stops in the line    sock = socket(AF_INET, SOCK_DGRAM, 0);

the message is “sys_arch_timeouts: ptask != NULL”

the procedure sequence is:

-lwip_socket (type=0, protocol=100)
-alloc_socket (newcon=0x80173c)
-sys_sem_wait (sem=0x805ea8)
-sys_arch_timeouts ()
-sys_assert ()

I have already tried a TCP socket but got same problem.
I am using lwIP 1.3.0 and freeRTOS 5.3.0. uController: MCF51CN128.
Could anyone help me?

void test_UDP_send( void * pvParameters )

       int sock;
       struct sockaddr_in sLocalAddr, sDestAddr;     
       char reply=“testing”;
       char buffer;
       int nbytes;

       sock = socket(AF_INET, SOCK_DGRAM, 0);
       memset((char *)&sLocalAddr, 0, sizeof(sLocalAddr));
       memset((char *)&sDestAddr, 0, sizeof(sDestAddr));

       sDestAddr.sin_family = AF_INET;
       sDestAddr.sin_len = sizeof(sDestAddr);
       sDestAddr.sin_addr.s_addr = htonl(INADDR_BROADCAST);
       sDestAddr.sin_port = 1234;
       sLocalAddr.sin_family = AF_INET;
       sLocalAddr.sin_len = sizeof(sLocalAddr);
       sLocalAddr.sin_addr.s_addr = htonl(INADDR_ANY);
       sLocalAddr.sin_port = 1235;

       bind(sock, (struct sockaddr *)&sLocalAddr, sizeof(sLocalAddr));

             nbytes=lwip_recv(sock, buffer, sizeof(buffer),8);
         if (nbytes>0){
             lwip_sendto(sock, buffer, nbytes, 0, (struct sockaddr *)&sDestAddr, sizeof(sDestAddr));

              lwip_sendto(sock, reply, sizeof(reply), 0, (struct sockaddr *)&sDestAddr, sizeof(sDestAddr));
              vTaskDelay( 200 );  //some delay!


davedoors wrote on Wednesday, January 27, 2010:

I suggest posting your question to the lwip mailing list.

acemax wrote on Wednesday, January 27, 2010:

I did it. Thanks