[DUG] help in socket service using delphi 5
Mike Stokes
mstokes at semantic.co.nz
Thu Apr 3 21:58:50 NZDT 2008
Hello Vikas,
I would use Indy 10 with TCP/IP Sockets with the following code to do this.
//IdTCPClient
MemoryStream.LoadFromFile(FilePath+FileName);
MemoryStream.Position := 0;
Write(MemoryStream, 0, true);
//IdTCPServer
ReadStream(MemoryStream, -1, false);
MemoryStream.Position := 0;
MemoryStream.SaveToFile(FilePath+FileName);
There are a number of other ways to do this such as FTP and HTTP
Requests / Posts.
Hope That Helps,
Mike
Vikas... wrote:
>
> Hi
>
> Any one have any idea how to tranfer the image from one server to
> another server usinng client socket. well i have doen the following things
>
> frist i have makde sure it get connects to the server. It gave me
> message saying connected too
>
> then i used the following code
> ClientDataStructure.ClientStrmData := TMemoryStream.Create;
> FillChar(ServerDataStructure.ServerFileSource,SizeOf(ServerDataStructure.ServerFileSource),0);
> -----
> ----
> StrPCopy(ServerDataStructure.ServerFileName,SourceFileName)
>
> ------
> -----
> ClientDataStructure.ClientStrmData.Seek(0,soFromBeginning);
>
>
> ClientDataStructure.ClientStrmData.Write(ServerDataStructure.ServerFileName,SizeOf(ServerDataStructure.ServerFileName));
> -----
> -----
> this is the source code i have also added the sam destination code in
> it where i have mentioend blank spaces
>
> in the end it says
>
> ClientDataStructure.ClientStrmData.CopyFrom(ClientDataStructure.ClientFileStream,0);
>
> ClientDataStructure.ClientStrmData.Seek(0,soFromBeginning);
>
> ClientSocket.Socket.SendStream(ClientDataStructure.ClientStrmData);
>
> it says succes in the end
>
> but i dint able to see any file in destination thing
>
> any diea where i am missing or u suggest any better apporach.
>
> Regards
> Vikas
>
>
>
>
> --
> vikas
> ------------------------------------------------------------------------
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at listserver.123.net.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at listserver.123.net.nz with Subject: unsubscribe
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.519 / Virus Database: 269.22.5/1356 - Release Date: 2/04/2008 4:14 p.m.
>
More information about the Delphi
mailing list