Version: 1.00.00 - last Update: Saturday, October 03, 2009, 19:45:00
Foxtools WinSock Library Functions
_WSOCKCLEANUP
_WSockCleanUp() is the third of three Foxtools functions that were added by Calvin Hsia. WSockStartUp() initializes the Winsock library. Call _WSockStartUp() and _WSockCleanUp() to initialize/uninitialize the Winsock library. The _WSockGetHostByAddr() function finally takes an IP address string like "123.123.123.123" and resolves it into the name of the machine.
_WSockCleanUp() wraps the Windows Socket function WSACleanup() <<< go there to find out the details! The following part is "borrowed” from Microsoft’s msdn Winsock Reference:
The WSACleanup function terminates use of the Winsock 2 DLL (Ws2_32.dll). This function has no parameters. The return value is zero if the operation was successful. Otherwise, the value SOCKET_ERROR is returned, and a specific error number can be retrieved by calling WSAGetLastError. In a multithreaded environment, WSACleanup terminates Windows Sockets operations for all threads. An application or DLL is required to perform a successful WSAStartup call before it can use Windows Sockets services. When it has completed the use of Windows Sockets, the application or DLL must call WSACleanup to deregister itself from a Windows Sockets implementation and allow the implementation to free any resources allocated on behalf of the application or DLL.
If you want to read more detailed information, follow link above.
VFP Syntax
iSuccess = _WSockCleanUp()
Parameters
None
VFP Example(s)
Calling the _WSockCleanUp() function can be accomplished with the following:
STORE 0 to buff1, buff2, buff3, buff4, buff5, buff6 IF _WSockStartUp(256 + 1, @buff1, @buff2, @buff3, @buff4, @buff5, @buff6) = 0 *\\ use your local IP address here IF _WSockGetHostByAddr("192.168.100.12", @buff1) = 1 ? m.buff1 ELSE Error “_WSockGetHostByAddr error” ENDIF = _WSockCleanUp() ENDIF