Should TIdCmdTCPServer and TIdCmdTCPClient be used together?

旧巷老猫 提交于 2019-12-10 19:30:20

问题


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


回答1:


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.




回答2:


Perhaps, you can start by testing demos




回答3:


TIdTCPServer does not receive anything on Android (Bug), The android can only send the data from i tidtcpclient to windows TidTCPServer and not reverse.



来源:https://stackoverflow.com/questions/2060751/should-tidcmdtcpserver-and-tidcmdtcpclient-be-used-together

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!