lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] lwip + FreeRTOS socket sharing error


From: alweib
Subject: [lwip-users] lwip + FreeRTOS socket sharing error
Date: Thu, 26 Apr 2018 10:49:14 -0700 (MST)

Hey everyone,

I'm having an issue sharing a TCP socket between two tasks in FreeRTOS (v.
7.0) and LWIP(v. 1.40).

I'm using the socket for a cmd / reply interface and also to send
information back asynchronously. These 2 ways of writing to the socket are
of course in two different tasks. I'm usign a semaphore to control access to
the socket:

bool wdpshell_write(void* data,int l){
if(pxNewWdpConnection != NULL)
  {
    xSemaphoreTake( xSemaphoreWdpBlock, portMAX_DELAY);
    bool err = (ERR_OK == netconn_write(pxNewWdpConnection, data, l,
NETCONN_COPY ));
    xSemaphoreGive( xSemaphoreWdpBlock );
    return err;
  }
  return false;
}

It works fine when only the cmd / reply or the async sends info back,
without the other running, but when both run i lose the connection. Setting
in a delay (vTaskDelay( webSHORT_DELAY );) after the semaphore take cmd, it
seems to work. Can anyone explain this behaviour? It would be very
detrimental for performance if there should be a delay for all traffic in
that direction.

It should be noted that i read on one task while writing in the other task,
but this should be allowed (as long as i don't do the same (R or W) in both
tasks at the same time).

Thanks in advance.

Aleksander



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html



reply via email to

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