home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / RXSOCK.ZIP / killsock.cmd next >
OS/2 REXX Batch file  |  1993-06-09  |  2KB  |  65 lines

  1. /*------------------------------------------------------------------
  2.  * killsock.cmd :
  3.  *------------------------------------------------------------------
  4.  * 08-05-92 originally by Patrick J. Mueller
  5.  *------------------------------------------------------------------*/
  6.  
  7. /*------------------------------------------------------------------
  8.  * get parameters
  9.  *------------------------------------------------------------------*/
  10. parse arg socks
  11.  
  12. if (socks = "") | (socks = "?") then
  13.    Usage()
  14.  
  15. /*------------------------------------------------------------------
  16.  * load function package
  17.  *------------------------------------------------------------------*/
  18. parse source os .
  19.  
  20. if (os = "OS/2") then
  21.    do
  22.    if RxFuncQuery("SockLoadFuncs") then
  23.       do
  24.       rc = RxFuncAdd("SockLoadFuncs","RxSock","SockLoadFuncs")
  25.       rc = SockLoadFuncs()
  26.       end
  27.    end
  28.  
  29. if (os = "AIX/6000") then
  30.    do
  31.    rc = SysAddFuncPkg("rxsock.dll")
  32.    end
  33.  
  34. /*------------------------------------------------------------------
  35.  * close each socket
  36.  *------------------------------------------------------------------*/
  37. do i = 1 to words(socks)
  38.    sock = word(socks,i)
  39.  
  40.    if datatype(sock,"W") then
  41.       say "closing" right(sock,5) ":" SockSoClose(sock)
  42.    else
  43.       say sock "is not a valid socket number."
  44. end
  45.  
  46. exit
  47.  
  48. /*------------------------------------------------------------------
  49.  * some simple help
  50.  *------------------------------------------------------------------*/
  51. Usage: procedure
  52.    parse source . . me .
  53.  
  54.    say "usage:"
  55.    say "   " me "<socket> <socket> ..."
  56.    say "is used to close sockets passed as parameters"
  57.    say
  58.    say "where:"
  59.    say "   <socket> - decimal socket number to close"
  60.    say
  61.    say "Convenient for closing sockets after running netstat -s for"
  62.    say "misbehaving applications"
  63.  
  64.    exit
  65.