PDA

View Full Version : ارتباط 2 کامپیوتر از طریق پورت کام



masihagroup
دوشنبه 25 اردیبهشت 1391, 10:58 صبح
سلام
من نیاز به 1 پروژه دانشجویی با عنوان ارتباط 2 کامپیوتر از طریق پورت کام که بشه 1 پیغام رو ارسال کرد و در سیستم دیگه اون پیغام رو نشون بده!!!

خودم اینو پیدا کردم - اگه درسته میشه توضیح بدین کد هاشو:

The client side program:


The client side program:

/* client.c */
#include
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
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 ) ;
}
}
}