Sign in to follow this  
Followers 0
dantay9

TCP File Transfer

15 posts in this topic

#1 ·  Posted (edited)

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
1 person likes this

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites



Thx a bunch!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

---

Edited by playlet

Share this post


Link to post
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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

---

Edited by playlet

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

---

Edited by playlet

Share this post


Link to post
Share on other sites

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.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

---

Edited by playlet

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

---

Edited by playlet

Share this post


Link to post
Share on other sites

Hello, my English is bad. This translation is from the site I write for. This sample program does not work. Please code the layout again?

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0