Function
start-sockets () => ()
start-sockets calls this underlying Winsock2 function.
start-sockets from a top-level form in any DLL project. The combination of this, and the restriction that you must call start-sockets before calling anything else, implies that no Network library function or variable can be called (directly or indirectly) from a top-level form in any DLL project. Instead, the DLL project should define a start function that calls start-sockets (directly or indirectly) or re-export start-sockets so that their clients can arrange to have it called from a top-level form in an appropriate EXE project.
start-sockets to be called (directly or indirectly) before any other sockets API functions. A good place to do this is at the beginning of your start function (usually the main method). For example:
define method main () => (); start-sockets(); let the-server = make(<TCP-server-socket>, port: 7); ... end; begin main(); end;
start-sockets and that are defined for DLL projects that use the Network library will inherit all of the restrictions described above for start-sockets.
start-sockets results in a <sockets-not-initialized> error. Calling start-sockets from a top-level form in a DLL project will result in unpredictable failures--probably access violations during initialization.