Jump to content

TCP File Transfer


dantay9
 Share

Recommended Posts

I know there are several FTP UDF's, but I had trouble finding examples. I also had a little trouble finding TCP sending systems that worked. And those that did work, didn't have a gui or anything. So I made a simple TCP file transfer system with a gui. It is for learning purposes. It isn't a big program, just an small, working example of how to use TCP protocol. Tell me how you like it.

Previous downloads: 72

TCP File Transfer.au3

Edited by dantay9
Link to comment
Share on other sites

Thanks! Mine is one of the smallest working file transfer systems with a gui on the forum. If you are looking for something a little more advanced, take a look at ftp. I think it is much easier to transfer files using ftp. A great example is Pocket FT.

Edited by dantay9
Link to comment
Share on other sites

@dantay9

I know that my FT-Pocket is a good example, but in this way i can't make better because autoit language does not support multi threading so I can't make a big program like Torrent to send and receive files from different ips, wich is very interessant...

I don't know if you have some ideas about your or mine script, but you can pm me and we will work together on it :)

Cheers, FireFox.

Link to comment
Share on other sites

@playlet

Welcome to the forum!

Yes there is a way. Seeing as you are new here, I will explain why you had to restart the program every time you sent a file. The reason was I never closed the listening port made at the very beginning of my receiver function. Before you can make a socket on a port, you must make sure you close all other sockets on that port. I closed the socket at the end of my receiver function.

I also added the drag and drop to the send tab. You don't need it for the receive tab because the input should be a folder, not a file.

Edited by dantay9
Link to comment
Share on other sites

before you can make a socket on a port, you must make sure you close all other sockets on that port. I closed the socket at the end of my receiver function.

false...

you can create more than one socket on a listening port i.e. you listen on port 80 and you have one client conected... if another client tries to connect you don't have to close the socket on the first client in order to make room for the second ... you can just handle both :)

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

false...

you can create more than one socket on a listening port i.e. you listen on port 80 and you have one client conected... if another client tries to connect you don't have to close the socket on the first client in order to make room for the second ... you can just handle both :)

Yes, I know that. But, the way my script is set up, for noobs, I create a new listening socket each time a file is received. It is for visual learning purpose and allows people to use the function without it relying on any other functions or variables.

Edited by dantay9
Link to comment
Share on other sites

  • 4 weeks later...

I think I know what you mean, but it all depends on what loop you want to exit the _ReceiveFile function at. Figure out which loop you want (or all three) and put something like this into the loop:

If _IsPressed("1B") Then ;Esc key
FileClose($FileHandle) ;only use after $FileHandle is opened
TCPCloseSocket($Socket)
TCPCloseSocket($Listen)
ToolTip("")
EndIf

That is for a keypress. You should be able to figure it out using a button with the same principles. Remember, this is just a very simple transfer program. There are much better and more involved programs on the forum.

Link to comment
Share on other sites

  • 1 year later...
  • 4 years later...
  • 11 months later...

I get a problem transfering files larger than about 20-30 megabytes... could it be beacuse the script sends all the binaries without "chunking" them?

*Edit* I just altered the script to send the file in 4kb pieces and all is working fine now :)

Edited by faldo
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...