Alek Posted May 11, 2007 Share Posted May 11, 2007 (edited) i made a little script that sends files with TCP, it works but its really slow. it is slow because it sends 1 byte at a time, i tryed to make it send more at 1 time but then the server had a hard time keeping up with the client and making the file corrupt. does anyone know a way to make it faster? Server CODE Global $MainSocket = -1 Global $ConnectedSocket = -1 Local $MaxLength = 2048; Maximum Length Of String Local $Port = 1000; Port Number Local $Server = @IPAddress1; Server IpAddress TCPStartup() $MainSocket = TCPListen($Server, $Port) If $MainSocket = -1 Then Exit MsgBox(16, "Error", "Unable to intialize socket.") $File = 0 While 1 If $ConnectedSocket= -1 Then $ConnectedSocket = TCPAccept($MainSocket) EndIf $Data = TCPRecv($ConnectedSocket, $MaxLength) $Data = StringSplit($Data, Chr(2)) Switch $Data[1] case "Filename" FileWrite(@ScriptDir & "/" & $Data[2],"") $File = $Data[2] Case "Create" FileWrite($File,Chr(StringTrimRight($Data[2],1))) TCPSend($connectedSocket,"Done") Case "Bye" TCPCloseSocket($ConnectedSocket) EndSwitch WEnd Func OnAutoItExit() If $ConnectedSocket <> - 1 Then TCPCloseSocket($ConnectedSocket) EndIf FileDelete("temp.txt") If $MainSocket <> -1 Then TCPCloseSocket($MainSocket) TCPShutdown() EndFunc;==>OnAutoItExit oÝ÷ Ûð¨uæèÄ)bz{B¡×£®¶s`¢6æ6ÇVFRfÇC´wV6öç7FçG2æS2fwC°¥D57F'GW¢b33cµ6ö7BÒÓ¢b33cµ6ö7BÒD56öææV7BFG&W73æFð 6ÆVW¥VçFÂb33cµ6ö7BfÇC²fwC²Ó ¢b33c´f÷&ÓÒuT7&VFRgV÷C²gV÷C²ÂsÂS¢b33c´çWCÒuT7G&Ä7&VFTçWBgV÷C²gV÷C²ÂÂÂSÂ#¢b33c´'WGFöãÒuT7G&Ä7&VFT'WGFöâgV÷C´'&÷w6RââgV÷C²ÂÂCÂsÂ#R¢b33c´'WGFöã"ÒuT7G&Ä7&VFT'WGFöâgV÷Cµ6VæBgV÷C²ÂÂCÂsÂ#R¢b33c´Æ&VÃÒuT7G&Ä7&VFTÆ&VÂgV÷C²gV÷C²ÂÂÂSÂCÂ&Dõ"b33cµ55ô4TåDU"Âb33cµ55õ5Tä´Tâ¢b33cµ&öw&W73ÒuT7G&Ä7&VFU&öw&W72ÂsÂSÂ# ¤wV6WE7FFR¦Fð b33c¶×6rÒwVvWD×6r bb33c¶×6rÒb33c´'WGFöãFVâ b33c´fÆRÒfÆT÷VäFÆörgV÷C²gV÷C²ÂgV÷C²gV÷C²ÂgV÷C²¢â¢gV÷C² uT7G&Å6WDFFb33c´çWCÂb33c´fÆR VæD` bb33c¶×6rÒb33c´'WGFöã"FVâ6VæFfÆR§VçFÂb33c¶×6rÒb33c´uTôUdTåEô4Äõ4P¤W@ ¤gVæ26VæFfÆR b33c´fÆRÒ7G&æu7ÆBuT7G&Å&VBb33c´çWCÂgV÷C²b3#²gV÷C² b33c´fÆRÒb33c´fÆU²b33c´fÆU³ÕÐ b33c´fÆW6¦RÒfÆTvWE6¦Rb33c´fÆR D56VæBb33cµ6ö7BÂgV÷C´fÆVæÖRgV÷C²fײ6""fײb33c´fÆR 6öçG&öÄF6&ÆRb33c´f÷&ÓÂgV÷C²gV÷C²Âb33c´çWC 6öçG&öÄF6&ÆRb33c´f÷&ÓÂgV÷C²gV÷C²Âb33c´'WGFöã 6öçG&öÄF6&ÆRb33c´f÷&ÓÂgV÷C²gV÷C²Âb33c´'WGFöã" f÷"b33c·ÒFòb33c´fÆW6¦P b33cµFWBÒfÆU&VBb33c´fÆRÂb33c· D56VæBb33cµ6ö7BÂgV÷C´7&VFRgV÷C²fײ6""fײ627G&æuG&ÔÆVgBb33c·FWBÂb33c·ÓfײgV÷C²ÂgV÷C² uT7G&Å6WDFFb33cµ&öw&W73Âòb33c´fÆW6¦R¢b33c· uT7G&Å6WDFFb33c´Æ&VÃÂgV÷Cµ6VæFærFF¢gV÷C²fײb33c·fײgV÷C²ògV÷C²fײb33c´fÆW6¦Rfײ5$Äbfײ7G&æuG&ÔÆVgBb33c·FWBÂb33c·ÓfײgV÷C²fÇC²ÒfwC²gV÷C²fײ627G&æuG&ÔÆVgBb33c·FWBÂb33c·Ó Fð b33c·&V7bÒD5&V7bb33cµ6ö7BÃ#C VçFÂb33c·&V7bfÇC²fwC²gV÷C²gV÷C° æW@ 6öçG&öÄVæ&ÆRb33c´f÷&ÓÂgV÷C²gV÷C²Âb33c´çWC 6öçG&öÄVæ&ÆRb33c´f÷&ÓÂgV÷C²gV÷C²Âb33c´'WGFöã 6öçG&öÄVæ&ÆRb33c´f÷&ÓÂgV÷C²gV÷C²Âb33c´'WGFöã" uT7G&Å6WDFFb33cµ&öw&W73äVæDgVæ0 ¤gVæ2öäWFôDWB¢bb33cµ6ö7BfÇC²fwC²ÓFVâ D56VæBb33cµ6ö7BÂgV÷C´'RgV÷C² D56Æ÷6U6ö6¶WBb33cµ6ö7B VæD`¢D56WFF÷vâ¤VæDgVæ3³ÓÒfwC´öäWFôDW@ Edit: Fixed the code so that the client have to wait for the server to reply befor sending more data Edited May 11, 2007 by Alek [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
Toady Posted May 11, 2007 Share Posted May 11, 2007 You need the server and the client to use handshaking. Once you send the data to the server, don't let the client send another packet of data until the server sends back an "OK" message. This way you should be able to send more than just one byte at a time, which is way faster. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
Alek Posted May 11, 2007 Author Share Posted May 11, 2007 (edited) You need the server and the client to use handshaking. Once you send the data to the server, don't let the client send another packet of data until the server sends back an "OK" message. This way you should be able to send more than just one byte at a time, which is way faster.ok i added so that the server need to reply befor sending more data, that allowd me to remove the sleep but now i need to make the client sendfile function read and send a larger part of the file, anyone know how??im thinking i need to use some smart math but i dont know where and what Edited May 12, 2007 by Alek [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
Alek Posted May 12, 2007 Author Share Posted May 12, 2007 sry for bumping this but i really need help with it [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
martin Posted May 12, 2007 Share Posted May 12, 2007 sry for bumping this but i really need help with it This bit looks wrong to me for $x = 1 to $Filesize $Text = FileRead($File,$x);$x should be the number of characters to read next not the ordinal of the character to read. TCPSend($Soct,"Create" & Chr(2) & Asc(StringTrimLeft($text,$x-1)) & ",") oÝ÷ Øay2¢ç(ºWaj÷¬¢g)à)jëh×6for $x = 1 to $Filesize $Text = FileRead($File,200);read 200 characters at a time TCPSend($Soct,"Create" & Chr(2) & $Text & ",")oÝ÷ ٩ݶ§~íë®÷«jëh×6Case "Create" FileWrite($File,$Data[2]) Would that work? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Alek Posted May 12, 2007 Author Share Posted May 12, 2007 (edited) I think you could have something like for $x = 1 to $Filesize $Text = FileRead($File,200);read 200 characters at a time TCPSend($Soct,"Create" & Chr(2) & $Text & ",")oÝ÷ Ûú®¢×Wy§tß¡bí´ÒgËajÑbêÞiÜ"ZÞi×â®ËvÓFòµë0«bv'pjËajØæ³Vòµæòæx4߬gºfÞ®Êo+^±©Ý¶¸¦x"·Ëkx-®)¥yûl¢ØZ¶'ô߬ i really need to make it faster, right now its about 100bytes per sec at its best and thats when i send it to @IPAddress1 Edited May 12, 2007 by Alek [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
martin Posted May 12, 2007 Share Posted May 12, 2007 FileRead($File,200) means that Fileread will read first 200 bytes what i did was that it reads 1 byte by reading $x numbers of bytes and triming it with stringtrimleft so that if $x = 4 it becomes the last byte of those 4 bytes (1byte) for $x = 1 to $Filesize $Text = FileRead($File,$x) TCPSend($Soct,"Create" & Chr(2) & StringTrimLeft($text,$x-1)) GUICtrlSetData($Progress1,(100/$Filesize)*$x) GUICtrlSetData($Label1,"Sending data: " & $x & "/" & $Filesize & @CRLF & StringTrimLeft($text,$x-1) & " <-> " & Asc(StringTrimLeft($text,$x-1))) Do $recv = TCPRecv($Soct,2048) until $recv = "done" Next i really need to make it faster, right now its about 100bytes per sec at its best and thats when i send it to @IPAddress1 But that is where I'm a bit lost, Why don't you send say 200 bytes instead of 1? I think you believe that Fileread($File,20) reads the first 20 characters from the beginning of the file. It doesn't; it reads the NEXT 20 characters. Have look at my previous post again. I can't see why what I suggest wouldn't solve your problem. You read $x bytes, which grows each time you loop. So the first time you read 1 byte ie byte number 1. The second time you read 2 bytes, ie byte 2 and 3, and then you only send one of those bytes. Then you read 3 bytes, ie bytes 4,5 and 6 and send only one of those. By the time you get to $x = 1000, you will be sending only 1 of 1000 characters. So by the time you finished you've only sent a tiny fraction of the file, and the rest has been ignored. Or I am completely misunderstanding your script? But in any case, why only send one byte at a time, why nor send 200 or 500? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Alek Posted May 12, 2007 Author Share Posted May 12, 2007 (edited) But that is where I'm a bit lost, Why don't you send say 200 bytes instead of 1? I think you believe that Fileread($File,20) reads the first 20 characters from the beginning of the file. It doesn't; it reads the NEXT 20 characters. Have look at my previous post again. I can't see why what I suggest wouldn't solve your problem. You read $x bytes, which grows each time you loop. So the first time you read 1 byte ie byte number 1. The second time you read 2 bytes, ie byte 2 and 3, and then you only send one of those bytes. Then you read 3 bytes, ie bytes 4,5 and 6 and send only one of those. By the time you get to $x = 1000, you will be sending only 1 of 1000 characters. So by the time you finished you've only sent a tiny fraction of the file, and the rest has been ignored. Or I am completely misunderstanding your script? But in any case, why only send one byte at a time, why nor send 200 or 500? Fileread($file,20) reads only the 20 first bytes, i tested it with this script $size = FileGetSize("Test3.au3") for $x = 1 to $size $data = FileRead("test3.au3",20) FileWrite("test.txt",$data) Next oÝ÷ Ù©ÝØ(¶Øb³Mú²,Þ feel free to correct me if im wrong and sorry if you dont understand me, my english kinda suck (i think) Edited May 12, 2007 by Alek [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
Alek Posted May 12, 2007 Author Share Posted May 12, 2007 i almost have it now, its a really messy script right now becuase i done so many test. the problem now is that the client sends the same 1024 bytes over and over again Client CODE expandcollapse popup#include <GuiConstants.au3> $exitloop = 0 Global $text[1025] $data = 0 $text2 = "" TCPStartup() $Soct = TCPConnect(@IPAddress1,1001) do sleep(10) Until $Soct <> -1 $Form1 = GUICreate("", 170, 150) $Input1 = GUICtrlCreateInput("", 10, 10, 150, 20) $Button1 = GUICtrlCreateButton("Browse..", 90, 40, 70, 25, 0) $Button2 = GUICtrlCreateButton("Send", 10, 40, 70, 25, 0) $Label1 = GUICtrlCreateLabel("", 10, 100, 150, 40, BitOR($SS_CENTER,$SS_SUNKEN)) $Progress1 = GUICtrlCreateProgress(10, 70, 150, 20) GuiSetState() do $msg = GuiGetMsg() if $msg = $Button1 then $File = FileOpenDialog("Open",@ScriptDir,"(*.*)") GUICtrlSetData($Input1,$File) EndIf if $msg = $Button2 Then sendfile() until $msg =$GUI_EVENT_CLOSE Exit Func sendfile() $File = StringSplit(GUICtrlRead($Input1),"\") $File = $File[$File[0]] $Filesize = FileGetSize($File) TCPSend($Soct,"Filename" & Chr(2) & $File) Do $recv = TCPRecv($Soct,2048) until $recv = "done" TCPSend($Soct,"Size" & Chr(2) & $Filesize) Do $recv = TCPRecv($Soct,2048) until $recv = "done" ControlDisable($Form1,"",$Input1) ControlDisable($Form1,"",$Button1) ControlDisable($Form1,"",$Button2) for $x = 1 to Round(($Filesize/1024),0)+1 ;the $Text = StringTrimLeft(FileRead($File,$x*1024),($x-1)*1024) ;problem for $y = 0 to 1023 ;is $text2 = $text2 & Asc(StringTrimRight(StringTrimLeft($text,$y),1023-$y)) & "," ;here Next ;some TCPSend($Soct,"Create" & Chr(2) & $text2) ;where Do $recv = TCPRecv($Soct,2048) until $recv = "done" Next ControlEnable($Form1,"",$Input1) ControlEnable($Form1,"",$Button1) ControlEnable($Form1,"",$Button2) GUICtrlSetData($Progress1,0) EndFunc Func OnAutoItExit() If $Soct <> -1 Then TCPSend($Soct,"Bye" & Chr(2)) TCPCloseSocket($Soct) EndIf TCPShutdown() EndFunc;==>OnAutoItExit oÝ÷ Û÷(uæèÅ'«½ê¡ף®¶s`¢6æ6ÇVFRfÇC´uT6öç7FçG2æS2fwC° ¤vÆö&Âb33c´Öå6ö6¶WBÒÓ¤vÆö&Âb33c´6öææV7FVE6ö6¶WBÒÓ¤Æö6Âb33c´ÖÆVæwFÒ#C²Ö×VÒÆVæwFöb7G&æp¤Æö6Âb33cµ÷'BÒ²÷'BçVÖ&W ¤Æö6Âb33cµ6W'fW"ÒFG&W73²6W'fW"FG&W70¥D57F'GW¢b33c´Öå6ö6¶WBÒD5Æ7FVâb33cµ6W'fW"Âb33cµ÷'B¤bb33c´Öå6ö6¶WBÒÓFVâWB×6t&÷bÂgV÷C´W'&÷"gV÷C²ÂgV÷CµVæ&ÆRFòçFƦR6ö6¶WBâgV÷C²¢b33c´fÆRÒ¢b33c·BÒ¢b33c·&BÒ¢b33c·Ò¢b33c´7&VFVfÆRÒ ¢b33c´f÷&ÓÒuT7&VFRgV÷C´f÷&ÓgV÷C²Â3Â#c¢b33c´VFCÒuT7G&Ä7&VFTVFBgV÷C²gV÷C²ÂÂÂ3Â##Âb33c´U5õ$TDôäŲb33cµu5õe45$ôIJb33c´U5ôUDõe45$ôĤuT7G&Å6WD&´6öÆ÷"b33c´VFCäuT7G&Å6WDföçBb33c´VFCÃ"ÂCÂÂgV÷Cµ&7FW"föçG2gV÷C²¤uT7G&Å6WD6öÆ÷"b33c´VFCÃ333¢b33c´'WGFöãÒuT7G&Ä7&VFT'WGFöâgV÷C´V×GFFgV÷C²ÂÂ#3ÂÂ#¤uT6WE7FFR ¥vÆR b33c¶×6rÒuTvWD×6r bb33c¶×6rÒb33c´'WGFöãFVâuT7G&Å6WDFFb33c´VFCÂgV÷C²gV÷C² bb33c´6öææV7FVE6ö6¶WCÒÓFVà b33c´6öææV7FVE6ö6¶WBÒD566WBb33c´Öå6ö6¶WB VæD` b33c´FFÒD5&V7bb33c´6öææV7FVE6ö6¶WBÂb33c´ÖÆVæwF b33c´FFÒ7G&æu7ÆBb33c´FFÂ6"" 7vF6b33c´FF³Ð 66RgV÷C´fÆVæÖRgV÷C° bfÆTW7G267&DF"fײgV÷C²ògV÷C²fײb33c¶FF³%ÒFVà b33c´fÆWGRÒ7G&æu7ÆBb33c¶FF³%ÒÂgV÷C²âgV÷C² f÷"b33c·ÒFò bæ÷BfÆTW7G267&DF"fײgV÷C²ògV÷C²fײb33c´fÆWGU³Òfײb33c·fײgV÷C²âgV÷C²fײb33c´fÆWGU³%ÒæBb33c´7&VFVfÆRÒFVâ fÆUw&FRb33c´fÆWGU³Òfײb33c·fײgV÷C²âgV÷C²fײb33c´fÆWGU³%ÒÂgV÷C²gV÷C² b33c´7&VFVfÆRÒ VæD` æW@ b33c´7&VFVfÆRÒ VÇ6P fÆUw&FR67&DF"fײgV÷C²ògV÷C²fײb33c´FF³%ÒÂgV÷C²gV÷C² VæD` b33c´fÆRÒb33c´FF³%Ð uT7G&Å6WDFFb33c´VFCÂgV÷CµG&ç6fW&ærfÆS¢gV÷C²fײb33c´FF³%Òfײ5$Äb D56VæBb33c´6öææV7FVE6ö6¶WBÂgV÷C´FöæRgV÷C² 66RgV÷C´7&VFRgV÷C° b33c·FWBÒ7G&æu7ÆBb33c¶FF³%ÒÂgV÷C²ÂgV÷C² f÷"b33c·ÒFòb33c·FWE³Ð fÆUw&FRb33c´fÆRÄ6"b33c·FWE²b33c·Ò uT7G&Å6WDFFb33c´VFCÂb33c´fÆVæfòfײ6"b33c·FWE²b33c·Ò æW@ D56VæBb33c´6öææV7FVE6ö6¶WBÂgV÷C´FöæRgV÷C² 66RgV÷Cµ6¦RgV÷C° uT7G&Å6WDFFb33c´VFCÄuT7G&Å&VBb33c´VFCfײgV÷C´fÆW6¦S¢¢gV÷C²fײb33c´FF³%ÒfײgV÷C²'FW2gV÷C²fײ5$Äb b33c´fÆW6¦RÒb33c´FF³%Ð D56VæBb33c´6öææV7FVE6ö6¶WBÂgV÷C´FöæRgV÷C² b33c´fÆVæfòÒuT7G&Å&VBb33c´VFC 66RgV÷C´'RgV÷C° D56Æ÷6U6ö6¶WBb33c´6öææV7FVE6ö6¶WB uT7G&Å6WDFFb33c´VFCÂgV÷C´Æ÷7B6öææV7FöâgV÷C² b33c´6öææV7FVE6ö6¶WBÒÓ VæE7vF6¥tVæ@ ¤gVæ2öäWFôDWB bb33c´6öææV7FVE6ö6¶WBfÇC²fwC²ÒFVà D56Æ÷6U6ö6¶WBb33c´6öææV7FVE6ö6¶WB VæD` fÆTFVÆWFRgV÷C·FV×çGBgV÷C²¢bb33c´Öå6ö6¶WBfÇC²fwC²ÓFVâD56Æ÷6U6ö6¶WBb33c´Öå6ö6¶WB¢D56WFF÷vâ¤VæDgVæ3³ÓÒfwC´öäWFôDW@ ¤gVæ2õ&VGV6TÖVÖ÷'¢FÆÄ6ÆÂgV÷C·6æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C´V×Gv÷&¶æu6WBgV÷C²ÂgV÷C¶ÆöærgV÷C²ÂÓ¤VæDgVæ0 [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
martin Posted May 12, 2007 Share Posted May 12, 2007 Just a note about the fileread. If you use the filename in file read then every time you use fileread it opens the file from the start again. You have to do this $hf = Fileopen("name of file",0) $text = fileread($hf,200) ;then it will read from where it left off before. . . . . FileClose($hf) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Alek Posted May 13, 2007 Author Share Posted May 13, 2007 now its geting close i added Fileopen and Fileread("File to send", 1024) The client reads 1024 bytes, encrypt it and sends it to the server, the server decrypts it and writes it to the file but the clien sends the same stuff over and over again i tryed to clean up the client script a bit CODEexpandcollapse popup#include <GUIConstants.au3> $showinfo = 0 $ConnectedSocket = -1 TCPStartup() $ConnectedSocket = TCPConnect(@IPAddress1, 1001) If @error Then MsgBox(4112, "Error", "Error: " & @error) Exit EndIf $Form1 = GUICreate("AForm1", 330, 75) $Input1 = GUICtrlCreateInput("", 5, 5, 240, 20) GUICtrlSetResizing(-1, $GUI_DOCKALL) $Button1 = GUICtrlCreateButton("Open", 245, 5, 40, 20) GUICtrlSetResizing(-1, $GUI_DOCKALL) $Button2 = GUICtrlCreateButton("Send", 285, 5, 40, 20, 0) GUICtrlSetResizing(-1, $GUI_DOCKALL) $Button3 = GUICtrlCreateButton("More info", 5, 55, 320, 15, 0) GUICtrlSetResizing(-1, $GUI_DOCKALL) $Progress1 = GUICtrlCreateProgress(5, 30, 320, 20) GUICtrlSetResizing(-1, $GUI_DOCKALL) $Edit1 = GUICtrlCreateEdit("", 5, 75, 320, 170, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL)) GUICtrlSetBkColor($Edit1, 0xFFFFFF) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $Filetosend = FileOpenDialog("Open", @ScriptDir, "(*.*)") If Not @error Then GUICtrlSetData($Input1, $Filetosend) Case $Button2 Sendfile() Case $Button3 Showinfo() EndSwitch WEnd Func Showinfo() If $showinfo = 0 Then Do $guipos = WinGetPos($Form1) WinMove($Form1, "", $guipos[0], $guipos[1], $guipos[2], $guipos[3] + 10) Sleep(1) Until $guipos[3] >= 285 WinMove($Form1, "", $guipos[0], $guipos[1], $guipos[2], 285) GUICtrlSetData($Button3, "Less info") $showinfo = 1 ElseIf $showinfo = 1 Then Do $guipos = WinGetPos($Form1) WinMove($Form1, "", $guipos[0], $guipos[1], $guipos[2], $guipos[3] - 10) Sleep(1) Until $guipos[3] <= 105 WinMove($Form1, "", $guipos[0], $guipos[1], $guipos[2], 105) GUICtrlSetData($Button3, "More info") $showinfo = 0 EndIf EndFunc ;==>Showinfo Func Sendfile() Local $Crypteddata $Filetosend = GUICtrlRead($Input1) If Not $Filetosend = "" Then $File = StringSplit($Filetosend, "\") $File = $File[$File[0]] $Filesize = FileGetSize($Filetosend) TCPSend($ConnectedSocket, "Filename" & Chr(2) & $File) Do $Recv = TCPRecv($ConnectedSocket, 2048) Until $Recv = "Done" $Filetoread = FileOpen($Filetosend, 0) For $x = 0 To ($Filesize / 1024) $Data = FileRead($Filetoread, 1024) For $y = 0 To 1023 $Precryp = StringTrimLeft(StringTrimRight($Data, 1023 - $y), $y) $Crypteddata = $Crypteddata & Asc($Precryp) & "," GUICtrlSetData($Edit1, "Encrypting file: " & $File & @CRLF & $Precryp & " <-> " & Asc($Precryp) & @CRLF & $y & " of 1024") Next GUICtrlSetData($Progress1, (100/ ($Filesize / 1024)) * $x) TCPSend($ConnectedSocket, "Create" & Chr(2) & $Crypteddata) Do $Recv = TCPRecv($ConnectedSocket, 2048) Until $Recv = "Done" Next GUICtrlSetData($Progress1, 100) GUICtrlSetData($Edit1, "Done") EndIf EndFunc ;==>Sendfile oÝ÷ Ûð¨uæèÅ8^±êïz¸¬²Ø¥·¦zË2 ^nZºÚ"µÍÚ[ÛYH ÑÕRPÛÛÝ[Ë]LÉÝÂÛØ[ ÌÍÓXZ[ÛØÚÙ]HLBÛØ[ ÌÍÐÛÛXÝYÛØÚÙ]HLBØØ[ ÌÍÓX^[ÝHL MÍÈX^[][H[ÝÙÝ[ÂØØ[ ÌÍÔÜHLNÈÜ[XØØ[ ÌÍÔÙHTYÜÌNÈÙYÜÂÔÝ BÌÍÓXZ[ÛØÚÙ]HÔÝ[ ÌÍÔÙ ÌÍÔÜ BY ÌÍÓXZ[ÛØÚÙ]HLH[^]ÙÐÞ M ][ÝÑÜ][ÝË ][ÝÕ[XHÈ[X[^HÛØÚÙ]][ÝÊBÌÍÑ[HHÌÍÝHÌÍÜYHÌÍÞHÌÍÐÜX]Y[HHÌÍÑÜLHHÕRPÜX]J ][ÝÐQÜLI][ÝËÎ BÌÍÑY]HHÕRPÝÜX]QY] ][ÝÉ][ÝËÎ ÌÍÑT×ÔPQÓH È ÌÍÕÔ×ÕÐÔÓ È ÌÍÑT×ÐUUÕÐÔÓ BÕRPÝÙ]ÐÛÛÜ ÌÍÑY]KBÌÍÐ]ÛHHÕRPÝÜX]P]Û ][ÝÑ[H]I][ÝËLÌL BÕRTÙ]Ý]J BÚ[HBIÌÍÛÙÈHÕRQÙ]ÙÊ BRY ÌÍÛÙÈH ÌÍÐ]ÛH[ÕRPÝÙ]]J ÌÍÑY]K ][ÝÉ][ÝÊBZY ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑH[^]ÛÜRY ÌÍÐÛÛXÝYÛØÚÙ]HLH[BIÌÍÐÛÛXÝYÛØÚÙ]HÔXØÙ ÌÍÓXZ[ÛØÚÙ] BQ[YIÌÍÑ]HHÔXÝ ÌÍÐÛÛXÝYÛØÚÙ] ÌÍÓX^[Ý BIÌÍÑ]HHÝ[ÔÜ] ÌÍÑ]KÚJBTÝÚ]Ú ÌÍÑ]VÌWBBPØÙH ][ÝÑ[[[YI][ÝÂBBQÕRPÝÙ]]J ÌÍÑY]K ][ÝÕ[Ù[È[N ][ÝÈ [È ÌÍÑ]VÌH [ÈÔBBBRY[Q^ÝÊØÜ [È ][ÝËÉ][ÝÈ [È ÌÍÑ]VÌJH[BBBIÌÍÑ[]HHÝ[ÔÜ] ÌÍÑ]VÌK ][ÝË][ÝÊBBBBQÜ ÌÍÞHHÈLBBBBRYÝ[Q^ÝÊØÜ [È ][ÝËÉ][ÝÈ [È ÌÍÑ[]VÌWH [È ÌÍÞ [È ][ÝË][ÝÈ [È ÌÍÑ[]VÌJH[ ÌÍÐÜX]Y[HH[BBBBBQ[UÜ]J ÌÍÑ[]VÌWH [È ÌÍÞ [È ][ÝË][ÝÈ [È ÌÍÑ[]VÌK ][ÝÉ][ÝÊBBBBBBIÌÍÐÜX]Y[HHBBBBBQ[YBBBS^BBBIÌÍÐÜX]Y[HHBBQ[ÙBBBBQ[UÜ]JØÜ [È ][ÝËÉ][ÝÈ [È ÌÍÑ]VÌK ][ÝÉ][ÝÊBBBQ[YBBIÌÍÑ[HH ÌÍÑ]VÌBBBUÔÙ[ ÌÍÐÛÛXÝYÛØÚÙ] ][ÝÑÛI][ÝÊBBPØÙH ][ÝÐÜX]I][ÝÂBBIÌÍÝ^HÝ[ÔÜ] ÌÍÑ]VÌK ][ÝË ][ÝÊBBBQÜ ÌÍÞHHÈ ÌÍÝ^ÌBBBBQ[UÜ]J ÌÍÑ[KÚ ÌÍÝ^ÉÌÍÞJJBBBS^BBUÔÙ[ ÌÍÐÛÛXÝYÛØÚÙ] ][ÝÑÛI][ÝÊBBPØÙH ][ÝÐYI][ÝÂBBUÔÛÜÙTÛØÚÙ] ÌÍÐÛÛXÝYÛØÚÙ] BBBQÕRPÝÙ]]J ÌÍÑY]K ][ÝÓÜÝÛÛXÝ[Û][ÝÊBBBIÌÍÐÛÛXÝYÛØÚÙ]HLBQ[ÝÚ]ÚÑ[[ÈÛ]]Ò]^] BRY ÌÍÐÛÛXÝYÛØÚÙ] ÉÝÈLH[BUÔÛÜÙTÛØÚÙ] ÌÍÐÛÛXÝYÛØÚÙ] BQ[YRY ÌÍÓXZ[ÛØÚÙ] ÉÝÈLH[ÔÛÜÙTÛØÚÙ] ÌÍÓXZ[ÛØÚÙ] BUÔÚ]ÝÛ B[[ÈÏOIÝÓÛ]]Ò]^] [font="Impact"]Never fear, I is here.[/font] 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