Solved

Retrieve a stream

Posted on 2000-05-16
4
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 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