a bit confused here...
asked Sep 19 '16 at 08:42
If you peel away all the layers of code and are able to get to the heart of the matter, i.e. the actual system-level socket calls, you'll find that there is no such thing as accepting connections in parallel. At the heart of it is this:
The "listen" system call (and it doesn't matter whether it's Windows, Linux, MacOSX, etc.) has an argument for a "backlog"
With Chilkat, you'll have a thread of your own whose sole job is to accept incoming connections and hand of the connected
socket to some other thread in your program that will read/write the connected socket. Your thread for receiving connections
should do only that -- receive (accept) a connection, and quickly give it to another thread for processing, and then get back to receiving
the next connection.
I can't give you an example of the application infrastructure you might design for your threading. The way to accept a connection is shown here: https://www.example-code.com/delphiAx/socket_accept.asp
The call to BindAndListen would be placed just before the loop. Your program would have a loop that calls AcceptNextConnection, hands the connected socket to something else (another thread) that owns and manages the connection, and then returns to the start of the loop to accept the next connection. The AcceptNextConnection loop should be in a background thread.
answered Sep 19 '16 at 08:43