Good day! There was a need to implement your own multithreaded server class (with # or VB .NET - not yet decided) for further use in your projects. There seems to be a lot of material on the Internet, but questions remain. I’m looking for answers to them: I see the work scheme as follows: Create a new class and start the server in it, the class generates three events (pseudo-code):

- подключилсяКлиент(клиент,данные) - отключилсяКлиент(клиент) - новыеДанныеОтКлиента(клиент,данные) 

The class holds information about each client in the form of a client class, which stores its number on the server, IP and so on. There may be many customers

The question is how to implement the work flow in this class. For example, when a message arrives, I want to safely create an event to transfer the above objects to it (so that from the parent class this data could only be used without unnecessary hemorrhoids associated with the flow). And how to work with server threads from the parent class? For example, the server has a send(клиент,данные) method send(клиент,данные) . How to implement? It is possible in c # or just the essence is better. I apologize for the illiteracy in this area. Before that, I worked only with the finished library, but it significantly limits me.

  • On Habré there is an article about the web server with the code and explanation: habrahabr.ru/post/120157 Try to start with it, and then ask more specific questions. - Mark Shevchenko
  • I read this article. My questions about which I wrote she does not answer. - Matvey
  • Well then, good luck with your development. - Mark Shevchenko
  • "Good luck with the development" is when there are no questions left. Is it too "appropriate" you answered? I asked a couple of questions. Just want to understand how to do here. - Matvey
  • 2
    You wrote "I figured out how to do it, but I do not know how to connect multithreading here." Answer: you come up wrong, do not do that. To enable multi-threading, look at a working multi-threaded server, and do the same. You write: no, here I have my decision, and I don’t want to understand how to do it, think for me how to arrange everything. Well, good luck with the development - quite adequate advice in this case. - Mark Shevchenko

0