Recently I started developing simple flash (flash is limited to tcp) real time multiplayer game and I needed a server to provide communication between clients. I decided to use Delphi XE + Indy for this purpose but I found out that Indy offers the synchronous communication model. (I have never used any of the Indy components.)
What I understood till now is that the synchronous (blocking) model limits concurrency and thus makes Indy TCP server component inappropriate for real time multiplayer game.
My question is : Should I use non-blocking communication and what are the best tools (components,classes etc) to implement it?
Also I will be very very happy if you provide me with example (source code) of using this tool to broadcast a message. – I want to send same message to each member of a particular “room” at once (but not send the message to other rooms’ members.).
PS
Sorry for my poor english (I dont speak it natively) 🙂
Thanks in advance. Any help is appreciated.
You are misunderstanding how Indy works. Yes, it does use blocking sockets, but that does not mean it cannot be used asynchronously. The
TIdTCPServercomponent is multi-threaded. It handles multiple client connections in parallel. It is certainly possible to send messages from one client to another, and to broadcast messages to multiple clients. I have posted such examples many times before on StackOverflow, the Embarcadero forums, and the Indy forum. Next time, please do a little research before asking questions.