Blocking/Non-blocking
The difference between a blocking call and a non-blocking call is the blocking call will wait until the operation is complete before returning, the non-blocking call will return immediately.
For example, if I call send() to write a large block of data to another computer, with blocking sockets, the call will return when a chunk of data has been sent or the call failed. With non-blocking sockets, the call will return immediately and you can do something else, then check later to see what happened.
Processing Multiple Connections
TCP uses the client/server model. You should note that a server is a piece of software, not hardware. The server initialises and begins accepting connections, so that's how you'd get a collection of connected clients in your original question.
What to do with them. You can deal with clients in parallel using multiple concurrent threads of execution or you can deal with them in one thread by multiplexing socket connections in a single thread. Of course you can mix these.
Multiplexing is the method that allows you to check if a client has something to send, and do a read only when that socket has something to send. So the loop looks like:
1 2 3 4 5 6 7 8 9 10 11
|
loop for ever
WaitForClientWithTimeout(clients)
if (timeout)
do something else for a while
else
for each client that we can read from
read from client
do some processing if needed
endfor
endif
endloop
|
The actual call that does this check is select().
What I Recomend
You need to understand the basics of socket communication. So stop what you're doing and take a look at some simple examples. Douglas Comer has published some minimal sample C programs that are very concise that I find are the best examples.
Once you understand in general what's going on, use a wrapper library to deal with the networking for you. Understanding the principles and writing robust networking software are two different things.
Once you get going, we can provide example code and possible network libraries on request.