Hi,
I read that same statement after I had posted and so I created another system
thread (been debugging the whole day):
sys_thread_new("handle_thread", handle_thread, NULL, 400, 3);
and tried to send from it, and it also hung in the same way, seems to not
return from a semaphore call deep in the bowls of lwip, still digging further
into it.
Maybe this will do the same and call back from the tcpipthread.
How would you propose structuring the code, I want one thread to receive
packets and another to send out? Is creating a system thread the right way to
go? Why would I be hanging with the code below?
Thanks for all the help!
void
handle_thread( )
{
while ( 1 )
{
if ( send_actual_pkt )
{
send_actual_pkt = 0;
uint8_t pkt[576];
// ... populate the pkt
uint16_t len = generate_pkt();
if ( lwip_sendto( s, pkt, len, 0, (struct sockaddr *)&from,
sizeof(from) ) != len ) <---- hanging here!!!!
{
uart_printf( "Didnt send correctly %x\n", len );
}
}
}
}
while( 1 )
{
if ( (lwip_recvfrom(s, raw_buf, sizeof(raw_buf), 0, (struct
sockaddr*)&from, (socklen_t*)&fromlen)) > 0 )
{
send_actual_pkt = 1;
}
}
________________________________
From: lwip-users <[email protected]> on
behalf of Dirk Ziegelmeier <[email protected]>
Sent: January 25, 2017 6:48 AM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] lwip_sendto hanging with lwip 2.0
Calling sys_timeout() results in send_actual_pkt being called back from TCPIP
thread. You must not call sequencial style functions from TCPIP thread.
http://www.nongnu.org/lwip/2_0_0/group__sequential__api.html says: "More
overhead, but can be called from any thread except TCPIP thread."
lwIP: Sequential-style APIs -
nongnu.org<http://www.nongnu.org/lwip/2_0_0/group__sequential__api.html>
www.nongnu.org
Detailed Description. Sequential-style APIs, blocking functions. More overhead,
but can be called from any thread except TCPIP thread.
Dirk
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users