Use the RESOLVE command to resolve a host name or an IP address.
.-,--30------. >>-SOCKET--(--"RESOLVE"--,--+-ipaddress----+--+------------+--)->< +-hostname-----+ '-,--timeout-' '-fullhostname-'
The command returns a string that contains the return code, the IP address, and the host name. The return code can be 0, a REXX socket API error number, or the REXX TCP/IP error number that is set by the socket command. The return code 0 indicates that the requested socket command was completed successfully.
0 10.201.202.1 BOB01.THEWORLD.COM
In
the example, 0 is the return code, 10.201.202.1 is the host IP address,
and BOB01.THEWORLD.COM is the host name.See Socket call error return codes for additional information about the numeric error codes that are returned by this command.
This command has no LE C/C++ equivalent.
/* REXX EZARXR23 */
/*
* This sample demonstrates the use of the RESOLVE
* socket command.
*/
src = socket("INITIALIZE","MYSET01");
src = socket("RESOLVE","your.hostname.here");
if word(src,1) = 0 then do
Say "The host name is "WORD(src,3)
Say "The IP Address is "WORD(src,2);
end;
src = socket("TERMINATE","MYSET01");
exit 0;