Looking for info about how to send/receive files using indy 10, i found this article:
https://stackoverflow.com/questions/16871393/need-help-sending-file-with-indy
It is to old
Yes, that post was written for Indy 9, not Indy 10.
Conexiones[Slot].context.connection.IOHandler.Write(AFileStream);
...
ConexionesCliente[Number].IOHandler.ReadStream(AFileStream);
You have a mismatch here. You are using the correct methods, but with the wrong parameters. By default, TIdIOHandler.Write(TStream) DOES NOT send the stream size, but TIdIOHandler.ReadStream() DOES expect a size to be sent. This is one of the rare cases where a pair of write/read methods do not compliment each other.
You need to either:
1. set the AWriteByteCount parameter of Write() to True:
Conexiones[Slot].Context.Connection.IOHandler.LargeStream := True;
Conexiones[Slot].Context.Connection.IOHandler.Write(AFileStream, 0, True);
...
ConexionesCliente[Number].IOHandler.LargeStream := True;
ConexionesCliente[Number].IOHandler.ReadStream(AFileStream);
LargeStream controls whether the stream size is sent/read as a 32bit or 64bit integer.
2. send/read the stream size explicitly:
Conexiones[Slot].Context.Connection.IOHandler.Write(AFileStream.Size);
Conexiones[Slot].Context.Connection.IOHandler.Write(AFileStream);
...
ConexionesCliente[Number].IOHandler.LargeStream := True;
ConexionesCliente[Number].IOHandler.ReadStream(AFileStream);
Or:
Conexiones[Slot].Context.Connection.IOHandler.WriteLn(IntToStr(AFileStream.Size));
Conexiones[Slot].Context.Connection.IOHandler.Write(AFileStream);
...
Size := StrToInt64(ConexionesCliente[Number].IOHandler.ReadLn);
ConexionesCliente[Number].IOHandler.ReadStream(AFileStream, Size, False);
Or, however other way you want to send/read the stream size.