Both will attempt to connect to the server on the specified port. Use the Connected method to determine if the connection was successful or you can use the return value of Connect . The Connect method returns 1 if connected, otherwise, 0. If a connect error occurs, use the ErorType method to get error information. The file Socket.
C enumerates the error types.
For simplicity, I designed this program to run from the command-line, rather than a CGI program run by the web server. I choose this approach so users could quickly run the program and see how the socket debug class works. Integrating the class into a CGI is very straight forward. If it fails to connect, it prints a message, and the error code and exits. If it connects, it prints the test string, writes the same string over a TCP socket to debug server and reports the result of the debug server write.