Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 file transfering
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Andy




PostPosted: Thu May 29, 2003 7:35 am   Post subject: file transfering

is it possible to have file transfer on a chat program made by turing??
Sponsor
Sponsor
Sponsor
sponsor
JSBN




PostPosted: Thu May 29, 2003 7:50 am   Post subject: (No subject)

yes, but from what i have heard, it is hard to go for more than 2 connections at a time Confused
Tony




PostPosted: Thu May 29, 2003 9:48 am   Post subject: (No subject)

open file as binary and send in packages untill the file is put back together on the other side.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Homer_simpson




PostPosted: Thu May 29, 2003 1:57 pm   Post subject: (No subject)

u dont need 2 connections but... u can only send files that have normal characters... =/... if anyone knows how to transfer a file with ascii or binary file like jpeg please pm me...
Andy




PostPosted: Thu May 29, 2003 6:15 pm   Post subject: (No subject)

can i just open the file as a text file and send it over slowly, and then use File.Rename to make it back to what ever extention it was before?
Homer_simpson




PostPosted: Thu May 29, 2003 7:46 pm   Post subject: (No subject)

it's not the file extention that matters it's the file contents that matter...
Andy




PostPosted: Thu May 29, 2003 8:03 pm   Post subject: (No subject)

i know, i was just saying, if i transfered the data within the file by opening it as a txt, maybe it'll work
Dan




PostPosted: Thu May 29, 2003 10:33 pm   Post subject: (No subject)

turing net comands have a bad haibt of losing bytes in the trasfer so the file may not wrok if it is like an exe or mp3 when you get it. txt and doc files may wrok a litte.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: Fri May 30, 2003 7:50 am   Post subject: (No subject)

lol turing sux... =Þ
Andy




PostPosted: Fri May 30, 2003 8:14 am   Post subject: (No subject)

stupid turing... damn holtsoft
hez




PostPosted: Sat May 31, 2003 6:29 pm   Post subject: i ahve done file transfer before

i have done file transfer before (NON-BIARY)

here is the code if you need it:
code:

%--------------------------------------------------REMOTE FILE SEND STUFF----------------------------
%----------Must have varaible --------------
var lock : int := 0
var rou2 : string := ""
%Load Bar
procedure GUIpercent (x1, y1, x2, y2, num : int)

    drawfillbox (x1 - 2, y1 - 2, x2 + 2, y2 + 2, grey)
    drawbox (x1 - 2, y1 - 2, x2 + 2, y2 + 2, black)

    for i : 1 .. round ((x2 - x1) * num / 100) by 10
        drawfillbox (x1 + i, y1, x1 + i + 7, y2, blue)
    end for

end GUIpercent


%----------------SAFE MODE TRANSFER PROCEDURE-------------
procedure safe
    var temp : string
    put "Do you want to transfer files in safe or fast mode?"
    put "Safe Mode: Less Chance of Data Loss"
    put "Fast Mode: More Chance of Data Loss"
    put "(S / F)"
    get temp
    put temp
    if length (temp) > 1 then
        put "INVALID ENTRY"
        delay (1000)
        cls
        safe
    elsif temp not= "s" and temp not= "S" and temp not= "F" and temp not= "f" then
        put "INVALID ENTRY"
        delay (1000)
        cls
        safe
    elsif temp = "s" or temp = "S" then
        lock := 0
    else
        lock := 1
    end if
end safe

%---------------------------------SEND MODULE--------------------------
procedure filesend
    var w1 : int
    w1 := Window.Open ("title:SEND MODULE,graphics:500;200,nobuttonbar")
    %-----------------get file name-----
    var file : string
    %------------menu choce-----------
    var c : int
    %----------fILEid----------
    var send : int
    %----TYPE of OUTPUT/INPUT------
    var typ : string := ""
    %------------port--------
    var p1 : int := 28001
    %-----------connection path-------------
    var netStream : int
    %-----------------net address----------
    var net : string
    %----------------percent done-------------
    var rou : real
    var lines, totallines : real := 0
    var temp : real := 0
    %--------------End percent done---------
    safe
    cls
    %--------------------------GET READY TO SEND----------------
    put "Enter file name to send....  " ..
    get file
    cls
    %---------------------SIZE------------------------
    put "Please hold... Calculating Size..."
    open : send, file, get
    loop

        exit when eof (send)
        get : send, typ : *
        totallines := totallines + 1

    end loop
    close (send)
    %---------------------CONTINUE----------------
    cls
    put "Enter host to send file too...  " ..
    get net
    cls
    put "Opening connection...."
    netStream := Net.OpenConnection (net, p1)
    cls
    if netStream <= 0 then
        put "Unable to Resolve Host: ", net, " On Port: ", p1
        delay (4000)
        quit
    end if
    %----------------------------LOOP SEND--------------------

    open : send, file, get

    put "Sending file... Press Any Key to Stop"
    %---------------------EXCHANGE TOTAL LINES---------------
    put : netStream, 00800
    put : netStream, totallines
    delay (1000)
    %------------START SENDING-------------------
    if lock = 0 then
        put "*SAFE MODE*"
        loop
            exit when hasch
            if eof (send) then
                put "Done Sending File..."
                exit
            end if
            get : send, typ : *
            put : netStream, typ
            delay (1)
        end loop
        close (send)
    else
        put "!FAST MODE!"
        loop
            exit when hasch
            if eof (send) then
                put "Done Sending File..."
                exit
            end if
            get : send, typ : *
            put : netStream, typ
            lines := lines + 1
            rou := (lines / totallines) * 100
            rou := round (rou)
            rou2 := realstr (rou, 1)
            locate (whatcol, whatrow)
            put "Sending File... ", rou, "% done..."
            GUIpercent (100, 100, 500, 110, strint (rou2))
        end loop
        close (send)
    end if

    %---------------------E     N     D -------MODULE---------------------------------------------------
    put "Have a Nice Day..."
    delay (1000)
    Window.Close (w1)
end filesend



%-----------------------------------------------GET MODULE--------------------------------
procedure fileget
    var w1 : int
    w1 := Window.Open ("title:GET MODULE,graphics:500;200,nobuttonbar")
    %-----------------get file name-----
    var file : string
    %------------menu choce-----------
    var c : int
    %----------fILEid----------
    var send : int
    %----TYPE of OUTPUT/INPUT------
    var typ : string := ""
    %------------port--------
    var p1 : int := 28001
    %-----------connection path-------------
    var netStream : int
    %-----------------net address----------
    var net : string
    %----------------percent done-------------
    var rou : real
    var lines, totallines : real := 0
    var temp : real := 0
    %--------------End percent done---------
    safe
    cls
    %------------GET READY TO RECIEVE-----------------
    put "Enter file name to save as....  " ..
    get file
    cls
    put "Waiting for connection...."
    netStream := Net.WaitForConnection (p1, net)
    cls
    %----------------------------LOOP RECIEVE--------------------
    open : send, file, put
    cls
    put "Receiving file... Press Any Key to Stop"
    %---------------------EXCHANGE TOTAL LINES---------------
    get : netStream, temp
    if temp = 00800 then
        get : netStream, temp
        totallines := temp
    end if
    %------------START RECIEVING-------------------
    if lock = 0 then
        put "*SAFE MODE*"
        loop
            exit when hasch
            if Net.LineAvailable (netStream) then
                get : netStream, typ : *
                put : send, typ
            end if
        end loop
        close (send)
    else
        put "!FAST MODE!"
        loop
            exit when hasch
            if Net.LineAvailable (netStream) then
                get : netStream, typ : *
                put : send, typ
                lines := lines + 1
                rou := (lines / totallines) * 100
                rou := round (rou)
                rou2 := realstr (rou, 1)
                locate (whatcol, whatrow)
                put "Recieving File... ", rou, "% done..."
                GUIpercent (100, 100, 500, 110, strint (rou2))
            end if
        end loop
        close (send)
    end if
    %---------------------E     N     D -------SUB Program---------------------------------------------------
    put "Have a Nice Day..."
    delay (1000)
    Window.Close (w1)
end fileget
%--------------------------------------------END FILE SEND STUFF---------------------------------------
procedure mfile
    var temp : int
    put "SEND? 1"
    put "RECIEVE? 2"
    get temp
    if temp = 1 then
        filesend
    elsif temp = 2 then
        fileget
    end if
end mfile
mfile


*ahem* *ahem* *waits for bits
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 11 Posts ]
Jump to:   


Style:  
Search: