home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dove!enh.nist.gov!tjb
- From: tjb@enh.nist.gov
- Newsgroups: alt.msdos.programmer
- Subject: com port problem
- Message-ID: <29AUG92.20284166@enh.nist.gov>
- Date: 30 Aug 92 00:28:41 GMT
- Sender: news@dove.nist.gov
- Organization: NIST
- Lines: 54
-
- Hi,
- I have an Xt and a 386,
- the XT is connected to a printer and a modem
- the 386's COM2 is connected to the XT's COM1 through a null-modem
- cable.
- i want to be able to use the printer&modem from the 386
- i can use the printer using a network program, but it's not compatible
- with a lot of stuff, and takes up LOTS of memory.
- i wanted to use the modem by writing a small C program that
- makes the XT transfer COM1 to COM2 and COM2 to COM1
- so that COM2(direct link to XT) on the 386 will function as a modem
- 386 XT
- --------- --------------
- COM2 -> COM1 -> COM2 -> modem
- COM2 <- COM1 <- COM2 <- modem
-
- my program so far is:
- ---------------------------------------------------------
- #include <conio.h>
- #include <dos.h>
- #undef inportb
- #undef outportb
- #define COM1 0x3f8
- #define COM2 0x2f8
- #define COM1S 0x3fd
- #define COM2S 0x2fd
- main()
- {
- int com1,com1s,com2,com2s;
- while( !kbhit() )
- {
- com1s = inport( COM1S );
- if( com1s & 2)
- {
- com1 = inport( COM1 );
- outport( COM2, com1 );
- printf("got %d from com1\n",com1);
- }
- com2s = inport( COM2S );
- if( com2s & 2 )
- {
- com2 = inport( COM2 );
- outport( COM1, com2 );
- printf("got %d from com2\n",com2);
- }
- }
- }
- -----------------------------------------------------------
- the program works if i type each letter twice slowly.
- does anyone know how to make it work??
- Thanks,
- Omri Barak
- Internet: barak@bguee.bgu.ac.il
- Bitner : barak@bguee
-