Solved

Streams over a TCP/IP socket

Posted on 2000-05-16
8
861 Views
Last Modified: 2010-04-04
I need a good TCP/IP unit that is capable of sending streams thru the socket.

A simple example of a GetStream() and PutStream() would be sufficient.

I'd like to use the TCP/IP components that come with Delphi 4.

IDeally, I'd like to use TReader and TWriter to read and write to a socket rather then a stream.

Well something like that...
0
Comment
Question by:arcrotty
8 Comments
 
LVL 2

Expert Comment

by:danysz
Comment Utility
There is a sample coming with delphi ( chat example) where is in use the sending of a string. In stead of string you just have to send a stream ( array of char- buffer).
To make the simplest check just change the functions in the example using StrPas on receiving and StrPCopy on sending to transform the strings to buffer.

Have a good day

daniel
0
 
LVL 3

Expert Comment

by:bryan7
Comment Utility
http://www.rtfm.be/fpiette/indexuk.htm
get ICS (fpiette's *free* components)
they are really great.. better than the components
coming with delphi, you can use UDP, TCP etc...
and send streams or strings..

it comes with a lot of well explained demos
and full source
0
 
LVL 7

Expert Comment

by:God_Ares
Comment Utility
http://www.angelfire.com/ok/GODARES/downl.html

get zwembroek or filetransver

Good Luck

God_Ares
0
 

Author Comment

by:arcrotty
Comment Utility
I have fpiette's routines.  I even use them.  I just wanted a simple routine to send a tstream in tact.  I can do this myself as I am not a newbie, but I wanted to see what other people came up with.  This is considered a very low value post coming from me as most questions I make worth in upwards of 500 each.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 2

Expert Comment

by:alsantos
Comment Utility
Use the ICS components, it have the TWSocket. Download it on http://www.rtfm.be/fpiette/indexuk.htm
0
 

Accepted Solution

by:
Perseo earned 150 total points
Comment Utility
// Server app
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
      Socket: TCustomWinSocket);
var
      S : TStream;
      C      :      Pointer;
begin
      S      :=      TFileStream.Create('c:\file2',fmCreate);
      GetMem(C,Socket.ReceiveLength);
      Socket.ReceiveBuf(C^,Socket.ReceiveLength);
      S.Write(C^,Socket.ReceiveLength);
      FreeMem(C);
      S.Free;
end;

//Client App
procedure TForm1.Button1Click(Sender: TObject);
begin
      ClientSocket1.Active      :=      True;
end;

procedure TForm1.ClientSocket1Connect(Sender: TObject;
      Socket: TCustomWinSocket);
var
      S : TStream;
begin
      S      :=      TFileStream.Create('c:\file1',fmOpenRead);
      Socket.SendStream(S);
      S.Free;
end;

0
 

Author Comment

by:arcrotty
Comment Utility
Answer accepted
0
 

Author Comment

by:arcrotty
Comment Utility
Hey that's pretty good.  I would have done something similiar.  You can have the points as not many people are responding anymore.

Cheers.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now