home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / os2 / programm / 7475 < prev    next >
Encoding:
Text File  |  1993-01-10  |  1.9 KB  |  52 lines

  1. Newsgroups: comp.os.os2.programmer
  2. Path: sparky!uunet!gatech!rpi!usc!wupost!cs.uiuc.edu!vela!vela!kwjung
  3. From: kwjung@vela.acs.oakland.edu (Kurt Jung)
  4. Subject: Re: Getting DOS to talk to OS/2
  5. Message-ID: <kwjung.726698770@vela>
  6. Organization: Oakland University, Rochester MI.
  7. References: <C0Mn3A.7zt@undergrad.math.waterloo.edu>
  8. Date: Sun, 10 Jan 1993 20:46:10 GMT
  9. Lines: 41
  10.  
  11. Paul Prescod writes:
  12. >What I'm asking really isn't so complex...I want to start an OS/2
  13. >editor from my DOS mail reader.  An OS/2 unzipper from my DOS term
  14. >program.
  15.  
  16. One of the cleanest ways is to detach an OS/2 background process which serves
  17. a named pipe.  The server just blocks on the pipe until another process opens
  18. it and makes some pre-established request.  This way, the server can be used
  19. for anything you might want to be done -- task switching, process execution,
  20. process and thread information, and it can be done easily from either DOS or
  21. OS/2.  Here is an outline:
  22.  
  23.   --- Server ---
  24.  
  25.   Call DosMakeNmPipe (Message mode is most convenient)
  26.   do {
  27.     Call DosConnectPipe
  28.     do {
  29.       Read client request with DosRead
  30.       Process request (usually this amounts to more OS/2 calls and pipe reads
  31.         and writes, depending on your message protocol)
  32.     } until requested to disconnct
  33.     Call DosDisConnectPipe
  34.   } until requested to terminate pipe
  35.   Call DosClose
  36.  
  37.   --- Client (DOS or OS/2) ---
  38.  
  39.   Open pipe as ordinary shared file
  40.   Write request, usually some scalar like unsigned short
  41.   Follow through with reads or writes, depending on protocol of your messages
  42.   Write disconnect or terminate request
  43.   Close file
  44.  
  45. I think it is best for it to send the disconnect message and close pipe prior
  46. interactive use, and then to re-establish the connection when the interaction
  47. is complete and the client is ready to make another request of the server.
  48. This keeps the server available for other processes, since only one connection
  49. can be made at a time.
  50.  
  51. -- Kurt
  52.