Pakku Posted December 23, 2005 Share Posted December 23, 2005 (edited) hi,thanks to Larry (see his topic ) i have made a sender and a receiver to send files from the sender over tcp to the receiver.bugs reports and stuff are welcome!senderexpandcollapse popup#include<GUIConstants.au3> GUICreate("Send",200,120) $File = GUICtrlCreateInput("",10,10,100,20) $fileopendialog = GUICtrlCreateButton(" ... ",120,10,40,20) $serverinput = GUICtrlCreateInput("",10,40,100,20) GUICtrlCreateLabel("Server-IP",120,40) $ok = GUICtrlCreateButton(" Send ",40,80,40,20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit EndIf If $msg = $fileopendialog Then $Fileopen = FileOpenDialog("File open",@desktopdir,"All (*.*)") GUICtrlSetData($File,$Fileopen) EndIf If $msg = $ok Then Call("sendfile") EndIf WEnd Func sendfile() Local $szConfirm = "" Local $sock = -1 Local $data $server = GUICtrlRead($serverinput) $FileSent = GUICtrlRead($File) TCPStartup() $sock = TCPConnect($server,50911) $data = FileRead($FileSent,FileGetSize($FileSent)) SplashTextOn("Send","Sending ...",200,40) TCPSend($sock,FileGetSize($FileSent) & "," & $data) SplashOff() While 1 $szConfirm = TCPRecv($sock,128) If @error Or StringLen($szConfirm) Then TCPShutdown() ExitLoop EndIf WEnd EndFuncreceiverDim $iMainSocket = -1, $iSocket = -1 Dim $buffer = "" Dim $bytes = -1 Dim $iRet = -1 TCPStartup() $iMainSocket = TCPListen(@IPAddress1,50911) While 1 If $iSocket = -1 Then $iRet = TCPAccept($iMainSocket) If Not @error Then $iSocket = $iRet Else $buffer &= TCPRecv($iSocket,4096) If $bytes = -1 And StringInStr($buffer,",") Then $bytes = StringLeft($buffer,StringInStr($buffer,",")-1) $buffer = StringTrimLeft($buffer,StringInStr($buffer,",")) Else SplashTextOn("Receive","Receiving ...",200,40) If StringLen($buffer) = $bytes Then SplashOff() $FileReceived = FileSaveDialog("File save",@desktopdir,"All (*.*)") ExitLoop EndIf EndIf EndIf WEnd FileDelete($FileReceived) FileWrite($FileReceived,$buffer) MsgBox(4096,"","Transfer Complete") TCPShutdown()p.s. it requires beta!merry christmas!http://www.autoitscript.com/fileman/users/arjan%20staring/Transfer%20over%20internet.zip Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
YoseMite Posted December 23, 2005 Share Posted December 23, 2005 Works fine and simple! Thanks for this script! Also a merry christmas! Link to comment Share on other sites More sharing options...
Mason Posted December 23, 2005 Share Posted December 23, 2005 *sigh* From what I can tell...yes this will send the file, but it will not send it in its original form causing it unable to run on the other end. You have to be able to open it and binary and keep it in this form as it is sent, and keep it in the excact form when it is written yet again. Link to comment Share on other sites More sharing options...
Skrip Posted December 23, 2005 Share Posted December 23, 2005 how do you find the server IP? [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
Pakku Posted December 24, 2005 Author Share Posted December 24, 2005 (edited) *sigh*From what I can tell...yes this will send the file, but it will not send it in its original form causing it unable to run on the other end. You have to be able to open it and binary and keep it in this form as it is sent, and keep it in the excact form when it is written yet again.what do you mean, when you send the file, the only thing the receiver has to know what the extension is like exe or jpg or what ever. when the sender sends hello.exe, the reciever can save ik like *.exe and afther it is saved, it is possible to open or run or what ever.if you don't mean this, can you please ask your question in an other way? Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
Pakku Posted December 24, 2005 Author Share Posted December 24, 2005 (edited) how do you find the server IP?the server ip is the ip of the receiver. Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
Mason Posted December 24, 2005 Share Posted December 24, 2005 did you try with the latest beta?Lar. :"> Larry. Link to comment Share on other sites More sharing options...
erifash Posted December 27, 2005 Share Posted December 27, 2005 If you sent an exe, wouldn't it hang on any Chr(0)'s? If so please check out my binary functions in my signature. I believe they might help you greatly. My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
jvanegmond Posted June 13, 2006 Share Posted June 13, 2006 If you sent an exe, wouldn't it hang on any Chr(0)'s? If so please check out my binary functions in my signature. I believe they might help you greatly. It does hang on Chr(0). Especially with images and video's. Your binary functions really help a lot when you are working with TCP. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Rahul Rohela Posted June 16, 2006 Share Posted June 16, 2006 Cool Link to comment Share on other sites More sharing options...
Pakku Posted June 16, 2006 Author Share Posted June 16, 2006 (edited) i will look at it in a while. fist i have to finisch my school work and stuff. Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
rambo3889 Posted July 12, 2006 Share Posted July 12, 2006 Hey Arjan this is Great.. Im not so good to Tcp stuff so i ask you would it be possible to change the code so the receiver is the script which tcpconnecter and the sender is the script which accepts? My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight! Link to comment Share on other sites More sharing options...
jvanegmond Posted July 12, 2006 Share Posted July 12, 2006 Hey Arjan this is Great..Im not so good to Tcp stuff so i ask you would it be possible to change the code so the receiver is the script which tcpconnecter and the sender is the script which accepts?Check my signature. github.com/jvanegmond Link to comment Share on other sites More sharing options...
{NL}--Xantios--- Posted September 18, 2006 Share Posted September 18, 2006 Bump ! Link to comment Share on other sites More sharing options...
jaenster Posted September 18, 2006 Share Posted September 18, 2006 Try to send some of 100 mb -jaenster Link to comment Share on other sites More sharing options...
jvanegmond Posted September 18, 2006 Share Posted September 18, 2006 jaenster. Good luck with that. github.com/jvanegmond Link to comment Share on other sites More sharing options...
GtaSpider Posted September 18, 2006 Share Posted September 18, 2006 (edited) Hi!I've written a script, too. I called it "File Over TCP"..You can find it herei will write it in english when i've time(mom it's in german)!So long Spider Edited September 18, 2006 by GtaSpider www.AutoIt.de - Moderator of the German AutoIt Forum Link to comment Share on other sites More sharing options...
Gif Posted May 20, 2007 Share Posted May 20, 2007 Hi!I've written a script, too. I called it "File Over TCP"..You can find it herei will write it in english when i've time(mom it's in german)!So long Spideralso add multiple connections (multiple receivers) Link to comment Share on other sites More sharing options...
jvanegmond Posted May 20, 2007 Share Posted May 20, 2007 also add multiple connections (multiple receivers)Thanks for digging up such an old topic.With the recent changes in AutoIt, this piece of code is totally outdated, and is succeeded by many others. github.com/jvanegmond Link to comment Share on other sites More sharing options...
BrettF Posted May 20, 2007 Share Posted May 20, 2007 Thanks for digging up such an old topic.My pleasure... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now