home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Product / Product.zip / oncmd.zip / SERVER.PRG < prev    next >
Text File  |  1996-02-13  |  713b  |  32 lines

  1. *
  2. * SAMPLE ADMINISTRATOR ... receives messages, prints 1st 20 chars
  3. *                          quits when "q" received
  4. setwin( 17, 5, 10, 35 )
  5. wintitle( 'Server Task' )
  6. clear
  7. admin = 'OI_ADMIN'
  8. i = 0
  9. rc = name_attach( admin, 200, 200 )
  10. if rc <> 0
  11.    msgbox("Name Attach", '('+str(rc)+') Could not attach' + admin, 7 )
  12.    quit
  13. endif 
  14.  
  15. run /w /n /b client
  16. s=space(80)
  17. do while .t.
  18.    rbytes = receive(s)
  19.    if left( s, 1 ) = 'q' 
  20.       reply( 'OK' )
  21.       exit
  22.    endif
  23.    reply( 'OK' )
  24.    if i = 0
  25.     @0,0 say admin + ' accepting messages.'
  26.    endif
  27.    @ 2,0 say alltrim(str(i++)) + ' messages received / replied to.'
  28. enddo    
  29. ? 'Request to terminate received.'
  30. name_detach()
  31. inkey(.1)
  32.