| View previous topic :: View next topic |
| Author |
Message |
cleiton Newbie cheater
Reputation: 0
Joined: 05 Mar 2014 Posts: 21
|
Posted: Sat Jul 12, 2014 2:15 pm Post subject: Send file via Socket |
|
|
Hi everyone,
I'm trying to send multiple files via socket but I'm having a problem, my program only send 1 file (or maybe my server only receive 1 file).
My code is:
| Code: |
var
Size : Int64;
i : integer;
begin
for i := 0 to lbFiles.Items.Count -1 do
begin
ArqTmp.Clear;
ArqTmp.LoadFromFile(lbFiles.Items.Strings[i]);
Size := ArqTmp.Size;
ClientSocket1.Socket.SendBuf(Size,SizeOf(Int64));
ClientSocket1.Socket.SendBuf(ArqTmp.Memory^,ArqTmp.Size);
end;
end; |
ListBox Item 1 = C:\abc.txt for example
Thanks
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25823 Location: The netherlands
|
Posted: Sat Jul 12, 2014 2:30 pm Post subject: |
|
|
print out the filenames to make sure it's sending them. (perhaps lbFiles is only 1 filename)
Anyhow, i never touched those socket classes, but check the results.
socket send doesn't always send everything, so check what it did sent and then send the rest until you've finally transferred everything (could be the resending is already done in the class for you, but you'll have to check the sourcecode for that)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
cleiton Newbie cheater
Reputation: 0
Joined: 05 Mar 2014 Posts: 21
|
Posted: Sat Jul 12, 2014 2:36 pm Post subject: |
|
|
| Dark Byte wrote: | print out the filenames to make sure it's sending them. (perhaps lbFiles is only 1 filename)
Anyhow, i never touched those socket classes, but check the results.
socket send doesn't always send everything, so check what it did sent and then send the rest until you've finally transferred everything (could be the resending is already done in the class for you, but you'll have to check the sourcecode for that) |
It's my first time programming in sockets.
Do you know any other method to send files over the internet?
|
|
| Back to top |
|
 |
|