Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

LWIP number of socket connections Issue

Hi Everyone,

I am writing a client server implementation of sockets using LWIP. I can successfully connect 3 clients to the server and send/receive data. When I try and connect a 4th client, the 4th client appears like it has connected but crashes immediately. On the server end the server appears not to have accepted the 4th connection (from my debug data).

When the server starts it creates a new task called ManageConnectionsTask using sys_thread_new. My server waits for incoming connection requests and then creates a new "read" task based on each incoming connection requests, I also tried switching to a new port but no joy. Is there a limit on how many connections a server can spin off? Has anyone had a similar issue?

ManageConnectionsTask()

{

socket()

bind()

listen()

while (true)

{

accept(pNetworkManager->fd_socket, ..);

if(!sys_thread_new(ReadSocketTask, &(pNetworkManager->client_sockfd),

(READ_CONN_PRIORITY + nPriorityOffset)))

DieWithError("ManageConnectionsTask: Can't create ReadSocketTask!\n");

. ..

}

}

Cheers,

Aiden
No RepliesBe the first to reply