Hi,

On Fri, Jun 18, 2021 at 3:36 AM Bo Berglund <bo.bergl...@gmail.com> wrote:

> On Sat, 12 Jun 2021 14:01:51 -0400, Selva Nair <selva.n...@gmail.com>
> wrote:
>
> >> I wonder if there is some way (on Windows) to start the tunnel
> connection
> >> from
> >> the special comm program and then close it down when the comm session is
> >> over
> >> and the program closes.
> >> I have written the comm program and I could add such a feature if it is
> >> possible
> >> to accoplish.
> >>
> >> OpenVPN-GUI is sort of a GUI program so I suspect it does not have any
> >> useful
> >> hooks...
> >>
> >
> >We have some support for sending commands to the GUI to
> >connect, disconnect etc.. See
> >
> >
> https://github.com/OpenVPN/openvpn-gui#send-commands-to-a-running-instance-of-openvpn-gui
> >
> >Selva
>
> I have now tested the individual commands to connect and disconnect using a
> small program just for testing this interaction. It seems to work very
> well.
>
> But when I integrated it into the main client application I found that what
> happens on the connect call
>
> openvpn-gui.exe --command connect serverconfig
>
> is that the connection dialog pops up showing all of the progress messages
> while
> connecting, but at this time the call to openvpn-client returns *before*
> the
> connection is established so my following actions are errored out because
> there
> is not yet a connection.
> When I traced this in the debugger with a breakpoint directly following
> the call
> it reaches the breakpoint before the dialog has finished...
>
> So now I am wondering if the connect call just *triggers* openvpn-gui to
> start
> the connect process but it does so in its main thread so it exits the user
> call?
>
>
That is correct. It uses Windows messages and returns as soon as the
message is delivered. You will have to do some checks like ping the remote
through the tunnel to determine the connection has started up. The status
window popup can be avoided by toggling silent-connection (see the
supported commands in README).

Selva
_______________________________________________
Openvpn-users mailing list
Openvpn-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-users

Reply via email to