danikf / tik4net

Manage mikrotik routers with .NET C# code via ADO.NET like API or enjoy O/R mapper like highlevel api.
Apache License 2.0
177 stars 94 forks source link

/system/reboot #32

Closed hebertonlp closed 6 years ago

hebertonlp commented 6 years ago

The command system reboot frozen the thread waiting for response that not exists, is possible to make a Command without a response waiter?

ex: ExecuteNonWait

danikf commented 6 years ago

Hi,

ExecuteNonQuery works for me. Done sentence is sent before router is rebooted. I will recommend to catch IOException around connection.Dispose (connection could be closed before logout is performed - I will address this behavior with next commit).

                var command = connection.CreateCommand("/system/reboot");
                command.ExecuteNonQuery();

... or simple call directly via connection (connection.CallCommandSync("/system/reboot")) with the same result.

D