hello
i am trying to demonstrate a simple example of time division multiplexing with 3 equal length text files between 2 serial connected computers
it is not working
here is the code
if anyone can help
CLS
start:
INPUT "Is this computer (t)ransmitting or (r)eceiving data?:", answer$
IF answer$ = "t" THEN
GOTO transmitting
ELSEIF answer$ = "r" THEN
GOTO receiving
ELSE
GOTO start
END IF
transmitting:
CLS
FILES "*.txt"
INPUT "Enter first file name:", file1$
INPUT "Enter second file:", file2$
INPUT "Enter last file:", file3$
OPEN file1$ FOR INPUT AS #1
OPEN file2$ FOR INPUT AS #2
OPEN file3$ FOR INPUT AS #3
OPEN "COM1:9600,N,8,1,ASC,CD0,CS0,DS0,RS" FOR OUTPUT AS #36
ON ERROR GOTO errhandle
PRINT "COM1 opened"
DO WHILE NOT EOF(3)
c$ = INPUT$(1, #1)
d$ = INPUT$(1, #2)
e$ = INPUT$(1, #3)
PRINT #36, c$; d$; e$;
LOOP
CLOSE #1, #2, #3, #36
END
receiving:
CLS
OPEN "1test.txt" FOR OUTPUT AS #5
OPEN "2test.txt" FOR OUTPUT AS #6
OPEN "3test.txt" FOR OUTPUT AS #7
OPEN "COM1:9600,N,8,1,ASC,CD0,CS0,DS0,RS" FOR INPUT AS #36
ON ERROR GOTO errhandle
PRINT "COM1 opened"
DO WHILE NOT EOF(36)
f$ = INPUT$(1, #36)
PRINT #5, f$;
g$ = INPUT$(1, #36)
PRINT #6, g$;
h$ = INPUT$(1, #36)
PRINT #7, h$;
LOOP
CLOSE #36, #5, #6, #7
END
errhandle:
SELECT CASE ERR
CASE 68: PRINT "COM1 is unavailable on this computer.": END
CASE ELSE: END
END SELECT
help not a programmer
-
- Veteran
- Posts: 1055
- Joined: Sun Jan 02, 2005 2:11 pm
- Location: At my computer
- Contact:
I've never read up on networking, but I'm sure this is the wrong way to open a COM port..
Thats either your prob, maybe you could check back with were ever you learned how to network and find the correct code..
Code: Select all
OPEN "COM1:9600,N,8,1,ASC,CD0,CS0,DS0,RS" FOR INPUT AS #36
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
(x.t.r.GRAPHICS)
- Mitth'raw'nuruodo
- Veteran
- Posts: 839
- Joined: Sat Jan 22, 2005 11:04 am
- Location: Eastern Coast of US
- Contact: