Step-by-step Usage Instructions
Add sock.tbs and sock.tbh files to your project (they are in current_library_set\sock\trunk).
Add include "sock\trunk\sock.tbh" to the includes section of the global.tbh file.
Call sock_get() whenever you need a free socket. Observe the result — if it is 255 then there are no free sockets available!
Call sock_release() when you no longer need a particular socket. This way, the socket can be reused by something else in your code.
Additional recommended steps
- The use of sock_who_uses() is optional. This call will return a string signature left by the caller when obtaining the socket. SOCK_MAX_SIGNATURE_LEN must be >0 for signatures to be saved.
We have provided a code snippet illustrating the use of the SOCK library.
Using the SOCK library? Then, use it everywhere in your code! Do not "appropriate" sockets without going through this library.