After you register the RexxSock functions, then you should call the function SockInit first. This function allows you to set some options for how RexxSock handles errors.

Normally, every RexxSock function sets the value of a variable named ErrNo. If the RexxSock function succeeds, then ErrNo is set to 0. If the RexxSock function fails, then ErrNo is set to some "error name". For example, if the SockConnect function fails because the server refused your attempt to connect, then SockConnect will set ErrNo to ECONNREFUSED. So, after every call to an RexxSock function, you should check the value of ErrNo to determine if the operation succeeded or failed.

Note: For a list of all of the possible error names that RexxSock may generate, see Error Names.

SockInit gives you the option of having a variable named SockErrNo used instead of ErrNo. This makes it less likely that you will have problems from inadvertently using ErrNo for some other purpose elsewhere in your script. If you do not name any of your variables or functions starting with the 4 letters Sock, then you should have no conflicts with RexxSock in your script.

Another option you have is to tell RexxSock to raise a USER condition whenever some RexxSock function fails. This relieves you of needing to check the value of ErrNo after every RexxSock call. You can simply CATCH the appropriate USER condition, and handle any errors there.

For example, to tell RexxSock to raise USER condition 10 whenever any RexxSock function fails, and to set the value of SockErrNo to the error name, then call SockInit as so:

/* Use SockErrNo and raise USER 10 on failures. */
SockInit(10, 1)