#!/usr/local/rexx/rxx /* * modclient - modem request client * * Program requests modem allocation from modserver (modem allocation * server) running on the network. * * * Modification history: * * 12 Aug 93 pjt Initial implementation * 14 Sep 94 pjt Add solaris-specific code, commented out by * default * */ arg request /* * Get host configuration * * This is currently set up to run the client on the same host as * the server. To run the client on a different host, change * '_gethostname()' in the following line to the name of the host * where the server is running. Be sure to put the hostname in * quotes to preserve its case. */ call _gethostbyname(_gethostname(), 'chost.') /* * Socket address structure */ net.sa_family = chost.h_addrtype net.sin_addr = chost.h_addr net.sin_port = 11111 /* * Create the socket */ socket = _socket(AF_INET, SOCK_STREAM) if socket < 0 then call error 'socket' /* * Connect to the server */ connectrc = _connect(socket, 'net.') if connectrc < 0 then call error 'connect' /* * Send the request to the server */ call sendbuf socket, request /* For solaris, call special version of sendbuf; comment out the line above and un-comment the line below */ /* call sendbufsolaris socket, request */ /* * Get reply back from server */ reply = recvbuf(socket) /* For solaris, call special version of recvbuf; comment out the line above and un-comment the line below */ /* reply = recvbufsolaris(socket) */ say 'Reply from modem allocation server' say '' say reply /* * Close the connection */ closerc = _closesocket(socket) if closerc < 0 then call error 'close' exit error: /* * Print function that failed, error number, and system error text. * Then call system exit function to really exit this process. */ say arg(1) 'error' _errno()':' _sys_errlist(_errno()) call _exit(1)