home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.os2.programmer
- Path: sparky!uunet!gatech!rpi!usc!wupost!cs.uiuc.edu!vela!vela!kwjung
- From: kwjung@vela.acs.oakland.edu (Kurt Jung)
- Subject: Re: Getting DOS to talk to OS/2
- Message-ID: <kwjung.726698770@vela>
- Organization: Oakland University, Rochester MI.
- References: <C0Mn3A.7zt@undergrad.math.waterloo.edu>
- Date: Sun, 10 Jan 1993 20:46:10 GMT
- Lines: 41
-
- Paul Prescod writes:
- >What I'm asking really isn't so complex...I want to start an OS/2
- >editor from my DOS mail reader. An OS/2 unzipper from my DOS term
- >program.
-
- One of the cleanest ways is to detach an OS/2 background process which serves
- a named pipe. The server just blocks on the pipe until another process opens
- it and makes some pre-established request. This way, the server can be used
- for anything you might want to be done -- task switching, process execution,
- process and thread information, and it can be done easily from either DOS or
- OS/2. Here is an outline:
-
- --- Server ---
-
- Call DosMakeNmPipe (Message mode is most convenient)
- do {
- Call DosConnectPipe
- do {
- Read client request with DosRead
- Process request (usually this amounts to more OS/2 calls and pipe reads
- and writes, depending on your message protocol)
- } until requested to disconnct
- Call DosDisConnectPipe
- } until requested to terminate pipe
- Call DosClose
-
- --- Client (DOS or OS/2) ---
-
- Open pipe as ordinary shared file
- Write request, usually some scalar like unsigned short
- Follow through with reads or writes, depending on protocol of your messages
- Write disconnect or terminate request
- Close file
-
- I think it is best for it to send the disconnect message and close pipe prior
- interactive use, and then to re-establish the connection when the interaction
- is complete and the client is ready to make another request of the server.
- This keeps the server available for other processes, since only one connection
- can be made at a time.
-
- -- Kurt
-