Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

transfer files between 2-computers

Status
Not open for further replies.

garg29

Advanced Member level 1
Advanced Member level 1
Joined
Nov 17, 2004
Messages
443
Helped
25
Reputation
50
Reaction score
10
Trophy points
1,298
Activity points
3,593
file transfer inportb baud rate

Hi,
Can anyone please tell me how can i transfer files between 2-computers using parallel port (without LAN card). I found one program in C++ to do this but it didn't worked out, i'm sending that as attachment. Please help me.

Thanks with best regards,
amit



/* File Transfer-Binu LS */

#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<dos.h>

int port_address;

void main()
{
void baudset(long );/*user defined fn. for setting baud rate.*/
void comparm(int,int,int); /*user defined fn. for setting parity, stopbits,databits etc.*/
FILE *f;
char chr;
char *fname;
int result,status,choice,port;
unsigned int fstat,mstat,lstat;
clrscr();
textcolor(6);
gotoxy(15,5);
cprintf("PROGRAM TO TRANSFER FILES BETWEEN TWO COMPUTERS ");
textcolor(3);
cprintf("Ver. 1.0\n");
gotoxy(12,6);
textcolor(14);
cprintf("By L.S Binu, Lect./Dept. of EIE/NI College of Engg.,Kumaracoil\n");
gotoxy(25,10);
textcolor(7);
cprintf("1. SEND FILE\n");
gotoxy(25,11);
cprintf("2. RECEIVE FILE\n");
gotoxy(25,12);
cprintf("3. EXIT\n");
gotoxy(25,13);
cprintf("Enter Your Choice(1,2 or 3):");
scanf("%d",&choice);
switch(choice)
{
case 1:
{
printf("\n");
printf("Select Port(Enter '1' for COM1 '2' for COM2):");
scanf("%d",&port);
if(port==1)
port_address=0x3F8;
else
port_address=0x2F8;
baudset((long)2400); /*set baud rate to 2400*/
comparm(0,1,8); /*no parity, 1 stop bit, 8 data bits*/
outportb(port_address+4,1|2);/*turn on hand shaking signals*/
textcolor(4);
printf("Enter file to send:");
scanf("%15s",&fname);
f=fopen(&fname,"r");
if(f==NULL)
{
cprintf("COULD NOT OPEN FILE: \n");
exit(0);
}
textcolor(2);
for(;;)
{
if(kbhit())
{
if(getch() == 27)/*if 'esc' key pressed then exit*/
exit(0);
}
lstat = inportb(port_address+5);/*if transmitter holding reg. empty*/
if(!(lstat & 32))/*send the next character*/
continue;
else
{
chr = fgetc(f);/*get a character from file*/
}
if (chr==EOF) /* if end of file*/
{
cprintf(" transmission completed");
outportb(port_address,EOF);
exit(0);
}
outportb(port_address, chr); /*send character*/
putchar(chr); /*display the character sent*/
}
fclose(f);
break;
}
case 2:
{
printf("\n");
printf("Select Port(Enter '1' for COM1 '2' for COM2):");
scanf("%d",&port);
if(port==1)
port_address=0x3F8;
else
port_address=0x2F8;
baudset((long)2400);
comparm(0,1,8);
outportb(port_address+4,1|2);
textcolor(4);
printf("Save as (file name):");
scanf("%15s",&fname);
f=fopen(&fname,"w");
if(f==NULL)
{
cprintf("COULD NOT OPEN FILE\n");
exit(0);
}
printf("Waiting for i/p \n");
cprintf("Press ESC to exit\n");
for(;;)
{
if(kbhit())
{
if(getch()==27)
break;
}
fstat=inportb(port_address+5);
if(fstat & 2)
cprintf("Over_run error\n");
if(fstat & 4)
cprintf("parity error\n");
if(fstat & 8)
cprintf("Framing error\n");
if(fstat & 16)
cprintf("Break received\n");
if(!(fstat & 1)) /*if data not ready*/
continue;
chr=inportb(port_address);/*if data ready read it from receive buffer*/
if(chr==EOF)
{
textcolor(2);
cprintf(" File received");
exit(0);
}
putchar(chr);
fputc(chr,f);
}
outportb(port_address+4,0); /*turn off hand shaking signals*/
fclose(f);
break;
}
case 3:
break;
}
}
void baudset(long baudrate)
{
unsigned int divisor;
unsigned char lsb,msb;
divisor=1152001/baudrate;
msb=divisor>>8;
lsb=(divisor<<8)>>8;
outportb(port_address+3,128); /*enable access to the divisor latches by setting the access bit in line cntrl. reg.*/
outportb(port_address,lsb); /*LSB of divisor*/
outportb(port_address+1,msb); /*MSB of divisor*/
}
void comparm(int parity,int stop,int databits)
{
int parmbyte;
parmbyte=databits-5;
if (stop==2)
parmbyte|=4;
if (parity!=0)
parmbyte|=8;
if (parity==2)
parmbyte|=16;
outportb(port_address+3,parmbyte);/*writing the cntrl. word corresponding*/
/*to the parity,stop bits etc. in the*/
} /*line control reg.*/
 

I didn't read the code very well
but i guess u tried this code in win2000 or winXP ,which will not work in them

try this code in win98 or winme and i guess it will works

bye
 

What problems did you have? Couldn't compile it? Couldn't run it?

That looks like an old Turbo C DOS program. It won't run under WinNT/2k/XP unless you install a port access driver. My favorite is PortTalk. Parallel Port Central has links to several port access drivers and PC-to-PC transfer utilities:
**broken link removed**

Tip: when you post source code to this forum, please highlight it and press the "code" button so we can see your formatted/indented code. You can also edit your original message and apply the change.
 

garg29 said:
Can anyone please tell me how can i transfer files between 2-computers using parallel port (without LAN card).

Your expl says parallel port, but your source code is using serial port. First clarify.

The program should work in dos shell even you are running on 2k. don't know about xp. the port accessing dlls are required if you are using VC++ etc.

If you have specific problems plese post more details...

best of luck
idlebrain
 

u install userport.zip

more information download the following files from yahoo group - parallelport

Parallel port for u(2.3Mb)
pforu
userport.zip
lpt.exe

and start studying parallel port for u and pforu
 

I tried out many things.....but none worked out. Can anyone please provide me a link from where i can download a readymade application which can transfer files between 2-computers , without LAN card (and also supports Win XP).

Thanks,
With best regards,
Amit
 

sir
u could use the direct connection wizard wich allrady fond in all windows os
with the proper nell modem cable
go to start menu >> accessories >> communication >> new connection wizard

then chose "setup an advance connection"

regards
 

yeh scart is right why do you need to use any other program or sofwtare when you have already got one in windows .it is called the direct cable connection between two computers. simply connect pcs through DB25 .you can buy the cale or DIY job. Otherwise you can also use null modem which is serial connectin through DB9.
Windows has a built in software called HYPER TERMINAL for null modem connection.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top