SkythekidRS Posted August 30, 2015 Share Posted August 30, 2015 (edited) i'm try a lot of way but the image from another computer ( i use TCP to send picture ) always like this....please help me....it's just load a little of image Edited August 30, 2015 by SkythekidRS Link to comment Share on other sites More sharing options...
TheDcoder Posted August 30, 2015 Share Posted August 30, 2015 Can you show us the full code used to send the picture? We can't help you without any code TD SkythekidRS 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
SkythekidRS Posted August 30, 2015 Author Share Posted August 30, 2015 here . sooooo sad..i try all my day but ... server.au3 client.au3 Link to comment Share on other sites More sharing options...
TheDcoder Posted August 30, 2015 Share Posted August 30, 2015 I am looking at it now... EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
TheDcoder Posted August 30, 2015 Share Posted August 30, 2015 Try this:server.au3:TCPStartup() $ip='192.168.1.4' $listen=TCPListen($ip,4444) Do $socket=TCPAccept($listen) $data=TCPRecv($socket,1342177280) Until $data<>Null $op=FileOpen('khang.jpg',18) FileWrite($op,$data)client.au3TCPStartup() $ip='192.168.1.4' $op=FileOpen('IMG_2474.JPG',16) $connect=TCPConnect($ip,4444) TCPSend($connect,FileRead($op)) TCPSend($connect,Null) FileClose($op) TD SkythekidRS 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
SkythekidRS Posted August 30, 2015 Author Share Posted August 30, 2015 Thanks for help me i will test that script Link to comment Share on other sites More sharing options...
SkythekidRS Posted August 30, 2015 Author Share Posted August 30, 2015 something wrong with the server script, i run then it close. Link to comment Share on other sites More sharing options...
TheDcoder Posted August 30, 2015 Share Posted August 30, 2015 @SkythekidRS Hmmm... try replacing Null with "Complete" EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
SkythekidRS Posted August 30, 2015 Author Share Posted August 30, 2015 now it create an image and exit before i run the client script @@! Link to comment Share on other sites More sharing options...
TheDcoder Posted August 30, 2015 Share Posted August 30, 2015 Crap, Replace <> with = I forgot to change those, TD EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
SkythekidRS Posted August 30, 2015 Author Share Posted August 30, 2015 TCPStartup() $ip=@IPAddress1 $listen=TCPListen($ip,4444) Do $socket=TCPAccept($listen) $data=TCPRecv($socket,1342177280) Until $data="Complete" $op=FileOpen('khang.jpg',18) FileWrite($op,$data) FileClose($op) TCPStartup() $ip=@IPAddress1 $op=FileOpen('IMG.jpg',16) $connect=TCPConnect($ip,4444) TCPSend($connect,FileRead($op)) TCPSend($connect,"Complete") FileClose($op)is this right?.....not work :< Link to comment Share on other sites More sharing options...
TheDcoder Posted August 30, 2015 Share Posted August 30, 2015 @SkythekidRS I am experimenting with TCP now, I will post a solution once I figure out the problem SkythekidRS 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
TheDcoder Posted August 30, 2015 Share Posted August 30, 2015 Ahhh.... I am still experimenting but I ran out of time , I need to go to bed. I will try to solve this issue tomorrow TD EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Celtic88 Posted August 30, 2015 Share Posted August 30, 2015 you can send big file serverexpandcollapse popupTCPStartup() Global $ip = @IPAddress1 Global $Port = 4444 Global $sSocket = -1 Global $LenSendData = 1024 * 1024 Global $PackSendfile = "[PackSendfile]" Global $EndPackSendfile = "[EndPackSendfile]" Global $lenEndPackSendfile = StringLen($EndPackSendfile) Global $RecevFileok = "[RecevFileok]" Global $Spdata = "[#Spdata]" Global $listen = TCPListen($ip, $Port) Global $sSocket = _Tcp_Get_Connection($listen) While True Sleep(100) _Getcmdtype($sSocket) WEnd Func _Getcmdtype($tsSocket) Local $Getcmdtype = TCPRecv($tsSocket, 999) If $Getcmdtype = "" Then Return False Select Case StringInStr($Getcmdtype, $PackSendfile) > 0 Local $Getfileinfo = StringSplit($Getcmdtype, $Spdata, 1) If @error Then Return False Local $Filesize = $Getfileinfo[2] Local $cSavepath = FileSaveDialog("Choose a filename...", @WorkingDir, "All (*.*)", 18, "test") If @error Then Return _Tcp_Exit() MsgBox(0, "", _Getdisplaysize(_Tcp_Rcv_File($tsSocket, $Filesize, FileGetShortName($cSavepath))) & " it was rcv") _Tcp_Exit() EndSelect EndFunc ;==>_Getcmdtype Func _Tcp_Rcv_File($sSocket, $Filesize, $cSavepath) Local $op, $Binfile, $binlen, $Timer, $tbinlen, $ps TCPSend($sSocket, $RecevFileok) $op = FileOpen($cSavepath, 18) ProgressOn("Progress Meter", "Receive state", "Start",default,default,16) $Timer = TimerInit() Do $Binfile = "" Do $Binfile &= TCPRecv($sSocket, $LenSendData) Until StringRight($Binfile, $lenEndPackSendfile) = $EndPackSendfile $Binfile = StringSplit($Binfile, $EndPackSendfile, 1) $Binfile = $Binfile[1] $binlen += BinaryLen($Binfile) FileWrite($op, $Binfile) TCPSend($sSocket, $RecevFileok) If TimerDiff($Timer) >= 1000 Then $Rate = $binlen - $tbinlen $ps = ($binlen / $Filesize) * 100 $tbinlen = $binlen ProgressSet(Int($ps), "Receive " & _Getdisplaysize($binlen) & " Of " & _Getdisplaysize($Filesize) & " " & Int($ps) & " % Rate " & _Getdisplaysize($Rate)) $Timer = TimerInit() EndIf Until $Filesize = $binlen ProgressOff() FileClose($op) Return $binlen EndFunc ;==>_Tcp_Rcv_File Func _Tcp_Get_Connection($sSocketlisten) Local $stSocket Do $stSocket = TCPAccept($listen) Until $stSocket <> -1 Return $stSocket EndFunc ;==>_Tcp_Get_Connection Func _Tcp_Exit() TCPCloseSocket($listen) TCPCloseSocket($sSocket) TCPShutdown() Exit EndFunc ;==>_Tcp_Exit Func _Getdisplaysize($isize) If $isize < 1 Then Return 0 Local $abytes[5] = [' Bytes', ' Kb', ' Mb', ' Go', ' Tb'] For $i = 4 To 1 Step -1 If $isize >= 1024 ^ $i Then Return Round($isize / 1024 ^ $i, 1) & $abytes[$i] Next Return $isize & $abytes[0] EndFunc ;==>_Getdisplaysize clientexpandcollapse popupTCPStartup() Global $ip = @IPAddress1 Global $Port = 4444 Global $LenSendData = 1024 * 1024 Global $PackSendfile = "[PackSendfile]" Global $EndPackSendfile = "[EndPackSendfile]" Global $RecevFileok = "[RecevFileok]" Global $Spdata = "[#Spdata]" Global $Connect = _Tcp_Clien_Connect($ip, $Port) Global $mFilepath = FileOpenDialog("Select a file..", @WorkingDir & "\", "All (*.*)", 1) If Not @error Then MsgBox(0, "", _Getdisplaysize(_Tcp_Send_file($Connect, FileGetShortName($mFilepath))) & " it was sent") TCPCloseSocket($Connect) TCPShutdown() Func _Tcp_Send_file($stSocket, $mFilepath) Local $op, $Iread, $rcv, $binlen, $Filesize, $Timer, $tbinlen, $ps, $zError = False $Filesize = FileGetSize($mFilepath) TCPSend($stSocket, $PackSendfile & $Spdata & $Filesize) Do $rcv &= TCPRecv($stSocket, 24) Until $rcv = $RecevFileok $op = FileOpen($mFilepath, 16) ProgressOn("Progress Meter", "Send state", "Start",default,default,16) $Timer = TimerInit() While True $Iread = FileRead($op, $LenSendData) If @error Then ExitLoop TCPSend($stSocket, $Iread & $EndPackSendfile) $binlen += BinaryLen($Iread) $rcv = "" Do $rcv &= TCPRecv($stSocket, 24) Until $rcv = $RecevFileok If TimerDiff($Timer) >= 1000 Then $Rate = $binlen - $tbinlen $ps = ($binlen / $Filesize) * 100 $tbinlen = $binlen ProgressSet(Int($ps), "Sent " & _Getdisplaysize($binlen) & " Of " & _Getdisplaysize($Filesize) & " " & Int($ps) & " % Rate " & _Getdisplaysize($Rate)) $Timer = TimerInit() EndIf WEnd ProgressOff() FileClose($op) Return $binlen EndFunc ;==>_Tcp_Send_file Func _Tcp_Clien_Connect($sIp, $mPort) Local $sSocket Do Sleep(100) $sSocket = TCPConnect($sIp, $mPort) Until $sSocket <> -1 Return $sSocket EndFunc ;==>_Tcp_Clien_Connect Func _Getdisplaysize($isize) If $isize < 1 Then Return 0 Local $abytes[5] = [' Bytes', ' Kb', ' Mb', ' Go', ' Tb'] For $i = 4 To 1 Step -1 If $isize >= 1024 ^ $i Then Return Round($isize / 1024 ^ $i, 1) & $abytes[$i] Next Return $isize & $abytes[0] EndFunc ;==>_Getdisplaysize SkythekidRS 1 Link to comment Share on other sites More sharing options...
SkythekidRS Posted September 1, 2015 Author Share Posted September 1, 2015 please can you make it simple? i try to understand that but so hard.. Link to comment Share on other sites More sharing options...
Celtic88 Posted September 1, 2015 Share Posted September 1, 2015 ok,try thisTCPStartup() $ip = @IPAddress1 $listen = TCPListen($ip, 4444) Local $data, $socket = -1 Do If $socket = -1 Then $socket = TCPAccept($listen) EndIf If $socket <> -1 Then $data &= TCPRecv($socket, 1024 * 1024) EndIf Until StringRight($data, 8) = "Complete" TCPSend($socket, "Complete") $data = StringTrimRight($data, 8) $op = FileOpen('khang.jpg', 18) FileWrite($op, $data) FileClose($op)clientTCPStartup() $ip = @IPAddress1 Do $connect = TCPConnect($ip, 4444) Until $connect <> -1 $op = FileOpen('IMG.jpg', 16) TCPSend($connect, FileRead($op) & "Complete") FileClose($op) Do Sleep(1) Until TCPRecv($connect, 8) = "Complete" SkythekidRS 1 Link to comment Share on other sites More sharing options...
matwachich Posted September 1, 2015 Share Posted September 1, 2015 If you need to ONLY transfert ONE file, all you have to do when transfert is done is to close the connection. No need for completion markers.If you need to transfert multiple files, end marker isn't the best solution. You'll have to announce file size first, then transfert file. SkythekidRS 1 Link to comment Share on other sites More sharing options...
SkythekidRS Posted September 2, 2015 Author Share Posted September 2, 2015 I know that thanks for reply me guys. And thanks for the help. 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