Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sending/recieving text in ClientSocket or ServerSocket

Posted on 1999-06-21
4
Medium Priority
?
825 Views
Last Modified: 2010-04-04
How can i send/recieve text in ClientSocket or ServerSocket.
can i have a sample source code for this
0
Comment
Question by:ryan_sabarre
[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
  • 2
4 Comments
 
LVL 1

Expert Comment

by:yk030299
ID: 1383960
To receive text, write something in Clientsocket1.Onread or ServerSocket1.Onread
E.g.
procedure TForm1.ClientSocket1Read(Sender: TObject;
  Socket: TCustomWinSocket);
var StrReceived:String;
begin
  StrReceived:=Socket.ReceiveText;
  //Process with StrReceived
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ClientSocket1.Socket.SendText('Hello');
end;

Assume you drop the components need on Form1!
0
 
LVL 1

Expert Comment

by:yk030299
ID: 1383961
U must set the host/address Port/service depend on your target!
0
 
LVL 15

Accepted Solution

by:
simonet earned 20 total points
ID: 1383962
Take a look at one of the demos installed with Delphi:

Delphi4\DEMOS\INTERNET\CHAT\CHAT.DPR
or
Delphi 3\DEMOS\INTERNET\CHAT\CHAT.DPR

This sample application uses both TCLientSocket and TServerSocket to send and receiv text-only information accross a peer-to-peer TCP/IP connection.

Yours,

Alex

0
 

Author Comment

by:ryan_sabarre
ID: 1383963
thank you for the code
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

670 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