File Transferring Using TCP/IP

Hi,
It is great to feel that some one stands behind you.I really appreciate your work.Ihave aquestion :
how to transfer a file(larger than 32kbyte)using TCP\IP?
THANKS
Rihab
rihabAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rihabAuthor Commented:
SHOULD I use threads and how?
0
MotazCommented:
Can you stablish a connection between to computers?

If you did you can slit a file into packets you can use untyped files, (BlockRead) then send it as a binarry buffers, but you have to send the file size inorder to send the data of the file.

You do not need to use Threads to send file, only you can use Application.ProcessMessages; in the loop of sending and reading file to allow other application processes to take place.

Offcourse this is not an answer so that let other experts write thier openion of this topic.

Good luck

Motaz
0
wmckieCommented:
I don't have a definitive answer for you but you might find help at these web sites. Both are sets of useful free components with many examples.

http://www.rtfm.be/fpiette/indexuk.htm

http://www.pbe.com/winshoes/

Also if you can use ftp you could look at this VB example:

http://www.mvps.org/vbnet/code/network/ftpdofiledownload.htm

I haven't tried it but it uses a procedure in shdocvw.dll (IE 5 only I think).

Good luck

Walter McKie
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

XANCommented:
you can use TCP/IP ClientSocket and ServerSocket to establish connection between they. I prefere blocking connection. ServerSocket open listen socket on spesified port (let it is N). ClientSocket connects to Server through the port (N). ServerSocket with ThreadBlocking connection create TServerClientThread for the connected client. You should define own successor from TServerClientThread with overloaded ClientExecute method. The method should use TWinSocketStream to do real data transfer (input and outpu).
It may be like this:

procedure TMyClientThread.Execute;
var
  TheSocketStream: TWinSocketStream;
  buffer: string;
begin
  { create a TWinSocketStream for reading and writing }
  TheSocketStream := TWinSocketStream.Create(ClientSocket1.Socket, 60000);
  try
    { fetch and process commands until the connection or thread is terminated }
    while (not Terminated) and (ClientSocket1.Active) do
    begin
      try
        GetNextRequest(buffer); { GetNextRequest must be a thread-safe method }

        { write the request to the server }
        TheSocketStream.Write(buffer, Length(buffer) + 1);
        { continue the communication (eg read a response from the server) }
        ...
      except
        if not(ExceptObject is EAbort) then
          Synchronize(HandleThreadException); { you must write HandleThreadException }
      end;
    end;
  finally
   TheSockettream.Free;
  end;
end;

it possible use TFileStream to file read/write operations

FS := TFileStream.Create(myFile, fmFileMode);
FS.SaveToStream(TheSocketStream);
FS.Free;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
haehnenCommented:
Listening...
0
yk030299Commented:
I remember there are 2 components: TFtpClient & TFtpServer in FPiette Package
0
ranmanorCommented:
Use streams.
0
bryan7Commented:
all you need is here..
http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=10104621 

just transfer a file using TFileStream in stead of the image..
0
rihabAuthor Commented:
thank alot for your answer it was so helpful
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.