pepe Posted December 19, 2012 Share Posted December 19, 2012 (edited) HI...I'm trying to make a connection to a client - server by tcp, which could send files larger than 1MB, but I don't know how...please help me!! I don't know whether to send it to me at a one time or do it in starges.Sorry for my english Edited December 19, 2012 by pepe Link to comment Share on other sites More sharing options...
FireFox Posted December 19, 2012 Share Posted December 19, 2012 I want to search on the forum but I don't know how !! Seriously, there is plenty of examples on the forum, Example Scripts section. Br, FireFox. Link to comment Share on other sites More sharing options...
pepe Posted December 19, 2012 Author Share Posted December 19, 2012 yes, but the person would like to start write programs would need some tip. I searched the forum and I can't see that there was something about tcp and files larger than 1mb Link to comment Share on other sites More sharing options...
FireFox Posted December 19, 2012 Share Posted December 19, 2012 yes, but the person would like to start write programs would need some tip.I searched the forum and I can't see that there was something about tcp and files larger than 1mbWhat's the problem with the files larger than 1mb ? you can send a whole data once, but It will block your script.You need to use _WinAPI_ files functions, to split the data and read at X offset.There is an example somewhere, just search for it. Link to comment Share on other sites More sharing options...
pepe Posted December 20, 2012 Author Share Posted December 20, 2012 meybe could someone tell me that it's okay? this is client expandcollapse popupFunc pobierz () $pobierz = FileOpenDialog ("Pobierz plik", @DesktopDir, "Wszystkie pliki (*.*)", 1) If @error Then MsgBox (0, "Informacja", "Nie wybrałes pliku") Else GUICtrlSetData ($input_pobierz, $pobierz) EndIf $size = FileGetSize ($pobierz) If $size = 0 Then MsgBox(16 , "Błąd" , "Zły plik") EndIf EndFunc Func wyslij () $name = name ($input_pobierz) TCPStartup () $socket = TCPConnect ("192.168.1.100", 1234) If $socket = -1 Then MsgBox (0, "Błąd", "Brak moliwosci nawiązania połączenia") EndIf TCPSend($socket, $name & ":" & $size) $return = False $open = FileOpen ($input_pobierz) $bytes = 0 While Not $return $data = FileRead ($open, $MAX_SIZE) If @error Then $return = True $bytes += TCPSend ($socket, $data) ToolTip(Round($bytes * 100 / $size, 2) & "%") WEnd FileClose ($open) TCPShutdown () EndFunc Func name ($input_pobierz) $reg=StringRegExp($input_pobierz, "(.)+((.)+)?", 3) If Not IsArray ($reg) Then Return $input_pobierz If UBound ($reg) < 2 Then Exit Return $reg[1] EndFunc Link to comment Share on other sites More sharing options...
Colyn1337 Posted December 20, 2012 Share Posted December 20, 2012 pepe, Looks to me like you're sending ok...... But is there something on the other end? You may need to create a listener at the destination.... Check out TCPListen() and TCPRecv() Link to comment Share on other sites More sharing options...
pepe Posted December 20, 2012 Author Share Posted December 20, 2012 if it comes to receiving now I do this, but it's hard for me to go 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