Solved

Retrieve a stream

Posted on 2000-05-16
4
197 Views
Last Modified: 2010-04-04
In the ClientSocket there's a method 'sendStream', but how can I retrieve the stream on the serverSocket???

This doesn't work :

//Client
procedure TForm2.ClientSocket1Connect(Sender: TObject;
  Socket: TCustomWinSocket);
var
  BinStream: TMemoryStream;
  strs:  TStrings;
begin
   strs := TStringlist.Create;

   strs.Add('test1');
   strs.Add('test2');
   strs.Add('test3');

   BinStream := TMemoryStream.Create;
   strs.SaveToStream(binstream);
   socket.SendStream(binstream);
   binstream.Free;
end;


//Server
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
  Socket: TCustomWinSocket);
begin
   listbox1.Items.Add(socket.ReceiveText);
end;

0
Comment
Question by:Smilly
4 Comments
 
LVL 3

Expert Comment

by:ckaneta
ID: 2815993
I would have to say, look at the ReceiveBuf method of the socket.
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2816204
listenning
check ICS demos
http://www.rtfm.be/fpiette/indexuk.htm
0
 
LVL 7

Accepted Solution

by:
God_Ares earned 20 total points
ID: 2818145
try this

pos := binstream.position;

strs.SaveToStream(binstream);

binstream.position := pos;

socket.SendStream(binstream);
   
also look at my little program

(filetransfer & zwembroek)
www.angelfire.com/ok/GODARES/downl.html


Have FUN

Greetz
0
 
LVL 1

Author Comment

by:Smilly
ID: 2847461
Comment accepted as answer
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 104
how to center only a line in richedit? 4 69
JAudiorecorder record freezing the app 29 82
Firemonkey allowing RTL on android 6 56
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

679 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