Sign in to follow this  
Followers 0
pepe

send file over tcp

7 posts in this topic

#1 ·  Posted (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 by pepe

Share this post


Link to post
Share on other sites



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.


 

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

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

Share this post


Link to post
Share on other sites

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

What'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.


 

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

meybe could someone tell me that it's okay?

this is client

Func 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

Share this post


Link to post
Share on other sites

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()

Share this post


Link to post
Share on other sites

if it comes to receiving now I do this, but it's hard for me to go

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