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

  1. *
  2. * Sample Client application
  3. *
  4.  
  5. setwin( 5, 5, 10, 35 )
  6. wintitle( 'Client Task' )
  7. on close stopit
  8. on click clickfun
  9.  
  10. for i = 1 to 15
  11.     server_id = name_locate( 'OI_ADMIN' )
  12.     if server_id < 0
  13.         inkey( .1 )
  14.     tone(1000)
  15.     else
  16.         exit
  17.     endif
  18. next i
  19.  
  20. if server_id < 0
  21.     ? 'Cannot connect to Server task'
  22.     inkey(2)
  23.     quit
  24. endif
  25.  
  26. @0,0 say 'Client messaging with OI_ADMIN' 
  27. @2,0 say 'Click this window to'
  28. @3,7 say 'terminate process'
  29. clicked = .f.
  30. inbuff=space(20)
  31. max=500
  32. for i = 1 to max 
  33.    send( server_id, str(i), len(str(i)), inbuff, 10 )
  34.    @ 4.5,0 say alltrim(str(i)) + ' messages sent of  ' +  alltrim(str(max))
  35.    if inkey( -1 ) <> 0 .or. clicked
  36.       i = max
  37.    endif
  38. next
  39. stopit()
  40.  
  41. Function stopit
  42.     para fld, lvl, key, row, cocl
  43.     ? 'Window closed, process terminating.'
  44.     send( server_id, 'q', 1, inbuff, 10 )
  45.     quit
  46. return 
  47.  
  48. Function clickfun
  49.     clicked = .t.
  50. return 
  51. * --- end ---
  52.