The loop is processing incoming messages and, if necessary, sending a response. But there are situations when you do not need to send an answer. Is it possible to prohibit a socket (for example, from another thread) to send messages without closing it, and then also allow it? I would not want to rewrite a bunch of methods for this, so I’m looking for an opportunity to make it easier.

  • Do you have a method where you send messages to the socket? Why not write an if (условие) {отправка сообщения} else выход ? - tym32167
  • There are many of these methods and they are universal. - Mihail
  • Your program can not agree with itself? Well, don't do a lot of methods for the same thing; make a central method. Your problem is solved by a normal architecture, and not by the fact that the right foot does the footrest with the left foot. - VladD
  • I agree with you, but at this stage due to circumstances, it would be convenient for me to do this. And out of curiosity I wanted to figure it out. - Mihail
  • Adding technical debt with words на данном этапе в связи с возникшими обстоятельствами мне было бы удобно сделать именно так - you are only doing yourself worse. All debts with these words are added. - tym32167 1:59 pm

0