Hi Damon... you need Deamon :smileywink: (not a joke).
It consist of a parentServerTask that listens for connections. When a connection is stablished it creates a new childserverTask, but previously it detaches the socket to send it as parameter to the childTask. This way you will have a task for each connection and server will be always free for listening.
The main parts of the code are next:
void serverChildTask(uint_32 initial_data)
{
listensock = socket(PF_INET, SOCK_STREAM, 0);
child_sock = accept(listensock, NULL, NULL);
/* Create a task to look after it */
if (RTCS_detachsock(child_sock) == RTCS_OK)
{
result = _task_create(0, SERVER_CHILD_TASK, child_sock);
if (result == MQX_NULL_TASK_ID)
{
RTCS_attachsock(child_sock);
shutdown(child_sock, FLAG_CLOSE_TX);
printf("\nCould not create server child task.\n\r");
}
}
void serverChildTask(uint_32 initial_data)
{
uint_32 sock = initial_data;
sock = RTCS_attachsock(sock);
...
If you consider this content solved your inquiry please mark it as correct answer.
Regards,
Carlos