A large number of potential power plants planned for connection to the distribution network require significant strengthening and upgrading of the distribution network in order to increase the network hosting capacity. In situations where investments in the development of the distribution network do not follow the trends in the integration of distributed energy sources, the development of the RES sector stagnates, and any further connection usually requires significant intervention in the network, which can sometimes represent a significant financial burden for investors. Such circumstances are currently present at the level of the HOPS transmission network where, among other things, there are restrictions related to the possibility of connecting RES (primarily VE) due to congestion in the transmission network in certain specific operating states and extraordinary operating states that imply the unavailability of certain network elements. Explicit satisfaction of the N-1 criteria as a condition for connection to the network then leads to circumstances and expensive solutions that require the evacuation of energy into the 220 and 400 kV networks even for lower rated power plants. Similar trends in the medium-term period can be expected at the level of distribution networks, where more significant integration of FNE (at the level of MV and LV networks) and smaller VE is expected, and in a somewhat later period, electric vehicles. Analyzes of connection to the network usually do not take into account the flexibility of the distribution network, which is manifested through the topological flexibility of the network, the possibility of voltage control at the level of the feeder substation, regulation of reactive power using KB or other devices for regulating reactive power, management of consumption and storage of electricity, …. Also, such analyzes do not consider the possibility of limiting the placement of working energy from production units that are connected to the network in critical operating conditions. The implementation and active use of all the mentioned factors is necessary for a quick and efficient transition of distribution networks according to the concept of smart networks. By taking into account all the mentioned factors that are at the disposal of the DSO, the reception capacity of the network is significantly increased and the dynamics of construction and connection of power plants is accelerated. In this paper, he will provide a mathematical model for maximizing the connection capabilities of the network and determining the optimal solution for connection to the network, taking into account the aforementioned factors that define the flexibility of the distribution network. For this purpose, a model based on integer mathematical programming with second-order cone approximation will be presented. On the concrete example of the network, the limit possibilities of acceptance of RES into the existing distribution network will be examined, while considering the implementation of different sources of flexible management of the distribution network as well as different variants of connection to the network.