There is a server with a white ip. Clients will connect to it via the Internet. After the client connects, a listening thread is created for this client and expects commands from the client. How to make so that the server could send any command to the client if you consider that the thread is waiting. Is it possible to send another server through a client socket on the server or create a connection to the client as to the server?

  1. TCP protocol
  2. TSocket from the WinSock module
  3. At the same time 20 - 30 customers
  4. Delphi XE 3 Development Environment
  • Please edit the question to include information on: 1. Communication protocol (TCP / UDP / HTTP / etc) 2. Components used (or planned to be used). 3. Estimated server load (the number of simultaneous connections). - kami
  • one
    Another clarifying question: is TSocket used, i.e. Work is done on pure WinAPI. How critical is this approach? Isn't it better to use at least TClient / TServerSocket? This is what I’m trying to do — working with the TCP streaming protocol on pure WinAPI is a hard thing, you need to take into account the splitting / gluing of packets, the Nagle algorithm, which will manifest itself very much when working via the Internet. Plus - 30 threads is not a good idea. There is a small add-on TClient / TServerSocket, if working with WinAPI is not necessary - I can try to lay out as a solution. - kami
  • Yes, please post it. will be very much - gregor
  • one
    Alas, my code does not fit in the number of characters reserved for the answer, and attachments do not seem to be allowed ... Therefore, for now I can only give a link (the archive with the example itself and the modules themselves are provided with very detailed comments). forum.vingrad.ru/… - kami
  • one
    Not necessary. Each thread is add. server load. If it is necessary to perform hard work on the server, a pool of threads is usually organized, each of which, if necessary, picks up work with a specific connection. A separate thread for each connection is too wasteful. - kami

0