Is it possible to enable / disable ethernet ports through code?

Running PLCnext Engineer 2021.9 with 1152 controller on 2021.0.0 LTS. MODBUS library version 9. PLC talking to VISU+ application. (VISU = client, PLC = server)
Can I force the ethernet ports on / off in my code? I’ve programmed it in structured text.
Having MODBUS TCP connection issues on network with high traffic surges and long latency.
MODBUS timeout gets triggered, most of the time it reconnects, some of the time it doesn’t. Suspected half open connections happening and occasionally no flow of data despite the MODBUS library server function block showing „connected.“ My error handing deactivates the server function block for a period of time and then activates it again… this probably should close sockets and reopen them but something is getting stuck on occasion. xConnected shows true on the function block but the modbus array does not get populated and then the server times out again, or my modbus heartbeat times out and the server fb is deactivated and the cycle starts again - never correcting itself.
If I do a hard reboot on the PLC the connection is re-established right away. I’m not an expert in this field but intuitively something tells me the connection is still being held open despite deactivating the function block, OR some kind of buffer is full and deactivating the function block is not clearing it out. Only a hard reboot clears it out and allows a reconnection.
Problem is I don’t want to have to hard reboot when this happens. Not a reasonable solution. I want to avoid any sort of reboot for that matter. Rather, if it is possible to deactivate the entire ethernet switch „virtually“ I would imagine it would have the same effect as a PLC reboot and flush out the whole ethernet backend and start fresh without PLC reboot.
Let me know your thoughts.
Thank you,