Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

Problem: new socket

Posted by André Fernandes on January 26, 2010
Hello,

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[1024];
int nbytes;

sock = socket(AF_INET, SOCK_DGRAM, 0);

memset((char *)&sLocalAddr, 0, sizeof(sLocalAddr));
memset((char *)&sDestAddr, 0, sizeof(sDestAddr));

//Destination
sDestAddr.sin_family = AF_INET;
sDestAddr.sin_len = sizeof(sDestAddr);
sDestAddr.sin_addr.s_addr = htonl(INADDR_BROADCAST);
sDestAddr.sin_port = 1234;

//Source
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));

lwip_close(sock);

for(;;)
{
nbytes=lwip_recv(sock, buffer, sizeof(buffer),8);
if (nbytes>0){
lwip_sendto(sock, buffer, nbytes, 0, (struct sockaddr *)&sDestAddr, sizeof(sDestAddr));
led_green_on();
vTaskDelay(200);
led_off();
vTaskDelay(500);
}

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


}
}

RE: Problem: new socket

Posted by Dave on January 27, 2010
I suggest posting your question to the lwip mailing list.

RE: Problem: new socket

Posted by André Fernandes on January 27, 2010
I did it. Thanks


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10.0.1 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS