When a connection is accepted by the server, the original
listening socket continues to listen for more connections. The socket
handle returned by InetAcceptEx should be used to exchange
information with the client.
This function will block the current thread until a connection has
been established or the timeout period has elapsed. To prevent it from
blocking the main user interface thread, the application should create
a background worker thread and accept the connection by calling
InetAcceptEx in that thread. If the application requires
multiple simultaneous connections, it is recommended you create a worker
thread for each connection.
The dwOptions argument can be used to specify the threading
model that is used by the library when a connection is established.
By default, the handle is initially attached to the thread that
created it. From that point on, until the handle is released, only the
owner may call functions using that handle. The ownership of the
handle may be transferred from one thread to another using the
InetAttachThread function.
Specifying the INET_OPTION_FREETHREAD option enables any thread to
call any function using the socket handle, regardless of which thread
created it. It is important to note that this option disables certain
internal safety checks which are performed by the library and may
result in unexpected behavior unless access to the socket is
synchronized. If one thread calls a function in the library, it must
ensure that no other thread will call another function at the same
time using the same socket handle.