no i does the following code but it doen't work .what will be the problem.
the code is
Code:
Hardware interaction will always take place through ports. Port I/O is not limited to functions such as inportb( ), outportb( ) etc. In this article we will see how two computers can communicate via the Serial/COM port.
The Serial/COM port is a 9/25-pin port connector at the back of a computer. 9-pin mail connectors are more common. All COM ports are mail connectors. If the connector is 25-pin and a female, it is an LPT port and not a COM port. The type of connector will not affect the performance of the port.
A serial port is so named because it transmits data serially i.e. one bit at a time. So even if there are 9/25-pins on the connector, only 3 are of importance to us. The other are either left open. Some are loped back. Looping back is something like fooling the computer to believe that it is actually connected to some serial device like a modem.
The serial port is commonly used by software developers to connect two computers for testing new software. One computer runs the software while the other records the information sent by the software. This method, often known as debugging helps the developers find errors in their program. The cable used for connecting the two computers is known as Null Modem cable, debug-cable, COM port to COM Port cable or simply serial cable. We will us this cable for our program. Our program will display whatever is typed on one computer on the other computer.
The software, is actually two different programs running on two different machines. The two machines are connected through the serial cable. Select one machine as the server and other as the client. The server will be used to type whereas the client will show whatever is typed. Any machine can be made the server or client.
The client side program:
/* client.c */
#include <bios.h>
main( )
{
int out, status ;
bioscom ( 0, 0x80 | 0x02 | 0x00, 0 ) ;
while ( ! kbhit( ) )
{
status = bioscom ( 3, 0, 0 ) ;
if (status & 0x100 )
{
out = bioscom ( 2, 0, 0 ) & 0x007F ; /* to check the 7 bit data for error condition */
if ( out != 0 )
putch ( out ) ;
}
bioscom ( 1, 0, 0 ) ;
}
}
The server side program:
/* server.c*/
#include <bios.h>
main( )
{
int in, status ;
bioscom ( 0, 0x80 | 0x02 | 0x00, 0 ) ;
while ( ( in = getch( ) != 27 )
{
status = bioscom ( 3, 0, 0 ) ;
if ( status & 0x100 )
{
bioscom ( 2, 0, 0 ) ;
bioscom ( 1, in, 0 ) ;
}
}