Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1342
  • Last Modified:

Indy Socket data transfer

I have a IdTcpServer and an IdTcpCLient correttly connected.. Now.. How do I send data from client to server and back to client? How do I trasfer a BYTE array, or a string? Thank you
0
ziggie301
Asked:
ziggie301
  • 3
  • 2
1 Solution
 
George TokasCommented:
You have to use Readxxx and Writexxx methods of the components...
Check out online help...

I'm not using Indy because they are using blocking socket configuration...
Instead I'm using the standard TServer/TClient sockets for the job...

In that case in example to send a string:
Server Side:
ServerSocket->Socket->Connections[x]->SendText("123");
For server socket we have to define the connection to send that identify the communication to the other end...

Client Side:
ClientSocket->Socket->SendText("123");

In this case there is only one socket connected and we don't have the Connected array...

To read what is sended:
Create a OnRead event handler (Double click OnRead on object manager) and inside add:

AnsiString S;
S = Socket->ReceiveText();

That is almost all...

George Tokas.
0
 
ziggie301Author Commented:
Sorry for my delay. I did'nt find any online help explaining how to transfer data after socket connection with indy sockets. that's why I was looking for some info about it. Does anyone know how to send data with Indy Sockets?
0
 
George TokasCommented:
BCB6 instal dir \Examples\Indy
17 subdirectories with examples...

George Tokas.
0
 
ziggie301Author Commented:
Sorry but I cannot find any subdirectory with indy examples.. I'm usingi Borland c++ Builder with Rad Studio 2007
0
 
ziggie301Author Commented:
I'm sorry. I was in a hurry, very nervous and mostly unprepared. This answer is excellent. Thank you
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now