Is it possible to handle Multiple TCP Connections in a single thread?
Absolutely... switch sockets into non-blocking mode and manage many connections within a single thread.
hSocket = socket(PF_INET, SOCK_STREAM, 0);
fcntl(hSocket, F_SETFL, O_NONBLOCK);
Then use a function to wait until one of your sockets changes status, something like
select()
. Since you mentioned ARM9 you need to check your SDK's documentation. If it supports normal socket functions (Berkeley style networking) there is a fair chance your embedded OS will support it too.
For more details and example source code how this could be done on a Linux/Windows platform see:
Beej's guide to networking programming (synchronous I/O multiplexing) and
Winsock Programmer's FAQ (select-based server).
Hope this helps!