Access a "WhoIs" Server.
Supported in QuikCode versions 2.35 and later.  Not the free DOS version.



    *******************************************************************
    * Program: WhoIs.q                                                *
    * Written: 6/14/2006                                              *
    * Purpose: This program accesses a "WhoIs" server to reveal       *
    *          information about a user-supplied IP address.          *
    * To Run : QuikCode whois.q nnn.nnn.nnn.nnn (Press Enter)         *
    *            Where nnn.nnn.nnn.nnn is a valid network IP address. *
    ******************************************************************* 

    equate SERVER     to 'whois.arin.net'  * A WhoIs Server 
    equate PORT       to '43'              * Whois port
    equate CRLF       to x'0D0A'           * Carriage Return/Linefeed
    equate BELL       to X'07'             * Ring console bell
    equate csa-idx    to wst1-i            * Index into CSA record
    cls

    if prma-recsize = 0
      display 'To run, type:  QuikCode whois.q nnn.nnn.nnn.nnn (Enter Key)'
      display '  Where nnn.nnn.nnn.nnn is a valid network IP address.'
      go to 200.

    display 'Connecting to WhoIs Server -> ' SERVER
    open csa SERVER ':' PORT TCPBinary 20
    if csa is not open
      display 'Unable to access server ' SERVER ' - ' val-error-cd
      go to 200.

    move prma-recsize to csa-recsize
    add 2             to csa-recsize
    move prma         to csa
    move 1            to csa-idx
    find space in csa by csa-idx
    move CRLF         to csa1(csa-idx)

    write csa 
    if val-error-cd <> 0
      display 'CSA write error - ' val-error-cd BELL
      go to 200.

    move 1            to csa-recsize
100 read csa at eof 200
    if val-error-cd <> 0
      display 'CSA read error - ' val-error-cd BELL
      go to 200.
    display csa noskip
    go to 100 

200 display
    system 'pause'
    end

Back to home Back to home