Particle photon, FreeRTOS, sockets, blocking accept

Hello.

Two quick questions:

  • Is there a blocking version of the server.available() function?

  • Can I have multiple clients connected on my server?

Thanks,
Vasileios.

edit: also is there a blocking version of the client.available() function?
I want a persistent connection with some clients.

I have been reading some other threads here and I noticed that when people are saying that a function is blocking, they mean that it is blocking the device and prevents it from running other processes, just like a while () loop that waits for something to be complete.

However in the above question, I mean exactly the opposite, that the function will block, meaning it will stop execution and the scheduler will perform a task switching, doing whatever it needs to do. Then, when the operation is completed, my blocked task will wake up and continue. This is also how blocking and non blocking is explained in the FreeRTOS documentation.

The functions I am asking for are special functions and the FreeRTOS provide an API not very different from the usual socket API.

Thanks again,
Vasileios.

There are no thread-blocking functions for any of the network APIs. It’s not a very efficient way to implement networking on a device with a small amount of stack and memory and no virtual memory. It’s much better to use non-blocking functions and a finite state machine.

Yes, you can have multiple TCP clients connected, but I believe the limit is 4.

1 Like

Yes I understand the limitaitons.
Thanks for the answer.

Vasileios.