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
Solved

Streams over a TCP/IP socket

Posted on 2000-05-16
8
878 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
ID: 2815943
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
ID: 2816201
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
ID: 2817292
http://www.angelfire.com/ok/GODARES/downl.html

get zwembroek or filetransver

Good Luck

God_Ares
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:arcrotty
ID: 2818595
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
 
LVL 2

Expert Comment

by:alsantos
ID: 2840087
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
ID: 2866111
// 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
ID: 2870524
Answer accepted
0
 

Author Comment

by:arcrotty
ID: 2870525
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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