Ok, to start things off, I'm making an Instant messaging program. I've got the basic idea of how it would work (correct me if I'm wrong).
The idea is whenever I type in a string, it uploads it to a folder and the other person is constantly checking for that string. When it sees that the string is there it downloads it and reads the file in their program. The same goes for them, the upload a file and I constantly check for it and when it is there, I download it and read it.
So far what I've gotten is:
set display mode 400,300,32
set window on
set window size 400,300
sync on : sync rate 60
server$="*****"
username$="*****"
password$="*****"
ftp connect server$,username$,password$
ftp set dir "*****"
y=10
canpress=1
fileyou=1
filethem=1
do
cls
abc$=entry$(1)+"_"
print abc$
if returnkey()=1
if canpress=1
open to write 1,"1"+str$(fileyou)+".txt"
write string 1,abc$
ftp put file "1"+str$(fileyou)+".txt"
inc fileyou
clear entry buffer
canpress=0
endif
else
canpress=1
endif
sync
loop
That's what I have for the sending part of the program, which is where I encounter my first error. Everything is getting uploaded right, but when I check the text inside the file on my server, it says a string that I had typed earlier on, not the one I just uploaded.
An example is I upload "Hello world", then a couple others and close the program. If I then come back open the program and type new strings, the first three files I upload will have the "Hello world" then the others and after all of the previous ones it starts showing my recent ones. I think this is due to not clearing the entry buffer in the right way? Or is it something else.
The next problem I'm having is checking for the files they uploaded. I just have no idea how to do it right. I tried using this:
print xyz$
ftp get file "2"+str$(filethem)+".txt","temp.txt"
if get ftp failure()=0
open to read 1,"temp.txt"
read string 1,xyz$
inc filethem
endif
Not only does the above cause the program great lag, it doesn't do anything! Anyone got any ideas?