SockInit | Enables/disables REXXSOCK features. |
SockSocket | Creates a socket. |
Enables/disables REXXSOCK features.
Synopsis
err = SockInit(UserNumber, UseSockErrNo)
Args
UseSockErrNo is a 1 if you wish REXXSOCK to set the variable name SockErrNo (instead of ErrNo). This may help to avoid a situation where your script (or some other add-on DLL) inadvertently uses the variable ErrNo for some other purpose. Omitting this arg will mean that REXXSOCK uses ErrNo.
Returns
0 if success, or 1 if an error.
Notes
There are some REXXSOCK functions that do not raise USER condition even for an error. They are SockLoadFuncs, SockDropFuncs, SockErrMsg, SockInit, SockPSock_Errno, SockSock_Errno, SockGetHandle, SockGetId, SockExit, and SockMaxPacketSize.
See Error Names for more information about handling errors.
You can call SockInit() repeatedly to change the USER condition, or turn it off.
See Also
SockExit
Creates a socket.
A socket must be created in order to be able to connect to another computer. This must be done once prior to actually connecting to, and then sending data to and/or receiving data from, that other computer.
Calls the socket library's socket() function.
Synopsis
socket = SockSocket(domain, type, protocol, 'assoc.', backlog, id)
Args
domain must be the string "AF_INET" (ie, REXXSOCK supports only internet domain connections). If omitted, defaults to "AF_INET".
type is one of the strings: "SOCK_STREAM", "SOCK_DGRAM", or "SOCK_RAW". The first supports bi-directional (full duplex) communication between two computers. The latter two operate connectionless by sending only messages from the "server" (ie, sender) to the "client" (ie, recipient). If omitted, defaults to "SOCK_STREAM".
protocol is one of the strings: "IPPROTO_UDP", "IPPROTO_TCP" (ie, TCP/IP protocol), or 0 if you do not wish to specify a protocol. (ie, The sockets library chooses a default protocol for you). If omitted, defaults to "IPPROTO_TCP".
'assoc.' is the same as the arg passed to SockBind. If you do not omit it here, then you do not need to call SockBind later. (ie, This is meant to be a convenience).
backlog is the same as the arg passed to SockListen. If you do not omit it here, then you do not need to call SockListen later.
id is the ID number you wish associated with this socket. If omitted, then REXXSOCK will pick out a unique ID number suitable for use with SockSelect's callback feature, and you can retrieve that ID number with a call to SockGetId.
Returns
Notes
The specific error name can be retrieved via ErrNo, and any error message retrieved via SockErrMsg.