Solved

Retrieve a stream

Posted on 2000-05-16
4
179 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

760 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

26 Experts available now in Live!

Get 1:1 Help Now