Multithreading Considerations

The sockets and network utility routines are completely reentrant. Multiple threads of an application can perform any socket call.

Note: Each thread that makes sockets calls has memory automatically allocated for it by TCPIP32.DLL to store per-thread information (such as the error code for the last sockets call made on that thread). If a thread only makes protocol-independent calls, the amount of memory allocated will be small (on the order of 100 bytes). If a thread issues any of the TCP/IP network utility calls, however, a 4K block will also be allocated for that thread. None of the memory that is allocated will be deallocated until the process terminates. It will be reused however, if a thread terminates and another thread is created.


[Back: Passing Sockets Between Processes]
[Next: Accessing a TCP/IP API DLL from an Intermediate DLL]