Link to home
Start Free TrialLog in
Avatar of mrk_raj
mrk_raj

asked on

Sending formatted text over a socket connection

     I am developing a Chat application using the delphi socket components. What should be the type of sockets in both the Client and socket components?.

      How will I send the contents of a Rich Edit control having formatted text over the Socket connection so that it can be accessed at the other end of the connection in the same format?.

    How will I place the Chat form(each user will have a separate form)Icon in the  Task Bar or in the system tray?.

Please help me?...

Avatar of Cesario Lababidi
Cesario Lababidi
Flag of Germany image

Hir mrk_raj,

to send the contents of a richt edit Control:

procedure TForm1.Button1Click(Sender: TObject);
var
  MemoryStream:TMemoryStream;
begin
  MemoryStream:=TMemoryStream.Create;
  RichEdit1.Lines.SaveToStream(MemoryStream);
  MemoryStream.Seek(0,soFromBeginning);
  ClientSocket.Socket.SendStream ( MemoryStream);
end;


To read the contents form a Stream:
RichEdit2.Lines.LoadFromStream(MemoryStream);


Best Regards

Cesario
Avatar of mrk_raj
mrk_raj

ASKER

hai Cesario,

  For sending the contents of a richedit control through
socket connection we can use the method sendstream.But
I couldn't find any method for receiving the stream sent
by the client socket.

ASKER CERTIFIED SOLUTION
Avatar of Cesario Lababidi
Cesario Lababidi
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How do I know a server has finished sending data when I am using TCPClient.receiveln();