Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should TIdCmdTCPServer and TIdCmdTCPClient be used together?

Tags:

delphi

indy

I am trying to write a server and a set of clients that talk to the server. The server will maintain the status of different clients and allow them to alert the central server when there is a status change. A specialist client will allow the control of the other connected clients.

I have the server as a TIdCmdTCPServer and the clients (at the moment) connect using TIdTCPClient.

If the clients are sending and recieving commands, should they use TIdCmdTCPClient? I have read that the CmdTCPServer and CmdTCPClient are not really used together - is it that they don't have to be used together?

So apologies for the general vagueness of the question, but I have only really just started looking at this and need a sort of heads out before I get bogged down in details.

Thanks for any help

Mark H

like image 933
mmmm Avatar asked Sep 18 '25 21:09

mmmm


2 Answers

It is technically possible to use use TIdCmdTCPClient and TIdCmdTCPServer together, but in general it is not advisable. Those components are designed for processing inbound commands asynchronously. It does not make sense to have a client waiting for server commands, but to have a server waiting for client commands at the same time. That is a good way to deadlock your connection, as they are both waiting for data from each other, and neither is actually sending anything without input first.

like image 141
Remy Lebeau Avatar answered Sep 21 '25 01:09

Remy Lebeau


Perhaps, you can start by testing demos

like image 37
Hugues Van Landeghem Avatar answered Sep 21 '25 00:09

Hugues Van Landeghem