VPN Working - WeOnlyDo Discussion board

VPN Working (wodVPN)

by Zeeshan Alam, Wednesday, October 03, 2007, 08:12 (6260 days ago)

Hello,

We are customer of WebServer and have been very happy with it.

I had a look at wodVPN and thinks it is very useful but I can not figure out how to make it work.

What I want is:-

PC A in US behind NAT of course, PC B in Europe behind NAT also, now I want to connect both the PCs, tell me the steps.

Thank you,
Zeeshan Alam

Re: VPN Working

by woddrazen, Wednesday, October 03, 2007, 11:02 (6259 days ago) @ Zeeshan Alam

Hi Alam,


You should specify on both sides MyID Property and Password Property. MyID Property holds user defined identity ID of local wodVPN. Password in Password Property should be same on both sides.
After that you should Starts listening and accepting connections. You can done that with wodVPN Start Method.

Now you are ready to search for other side. For that Search Method should be called on both sides.
To correctly use this type of search, you should put hostname of the mediator in Arg1 (such as www.weonlydo.com ), and port of the mediator in Arg2 (such as 8000). You can use your mediator if you wish.
Search Method will start SearchDone Event. In SearchDone Event if search is successful you can connect to other side. For that you should call Connect Method on both sides.
Connect Method holds parameters for remote IP and Port. You can find that information inside SearchDone Event.

If connection is successful Connect Method will start Conneced Event. In Connected Event you can Add channels to begin forwarding ports between local and remote side or can send text messages...

More help for MyID Property you can find here:
http://www.weonlydo.com/VPN/Help/WODVPNLib~wodVPN~MyID.html

More help for SearchDone Event you can find here:
http://www.weonlydo.com/VPN/Help/WODVPNLib~wodVPN~SearchDone_EV.html

On the left side of hep file you can find help for all other wodVPN Objects, Properties, Method and Events.

You can find examples in wodVPN Samples folder. In samples two forms will be created (for local test) but if you testing from two location you should use one form on each side.

Here is also simple example:

location1:
[code]
Option Explicit
Dim WithEvents vpn1 As wodVPNCom
Private Sub Form_Load()
Set vpn1 = New wodVPNCom

vpn1.RetryWait = 1000
vpn1.RetryCount = 0
vpn1.MyID = location1
vpn1.Password = password
vpn1.Start (0)
vpn1.Search SrchUDPSingle, location2 , www.weonlydo.com , 8000

End Sub

Private Sub vpn1_SearchDone(ByVal IP As String, ByVal Port As Long, ByVal ErrorCode As Long, ByVal ErrorText As String)

If ErrorCode <> 0 Then
Debug.Print SearchDone Event error: & ErrorText
Else
Debug.Print Search done
Debug.Print IP: & IP & Port: & Port
vpn1.Connect IP, Port
End If

End Sub

Private Sub vpn1_Connected(ByVal PeerID As String, ByVal IP As String, ByVal Port As Long)
Debug.Print CONNECTED to & IP & (on port & Port & )
End Sub
[/code]

location2:
[code]
Option Explicit
Dim WithEvents vpn2 As wodVPNCom
Private Sub Form_Load()
Set vpn2 = New wodVPNCom

vpn2.RetryWait = 1000
vpn2.RetryCount = 0
vpn2.MyID = location2
vpn2.Password = password
vpn2.Start (0)
vpn2.Search SrchUDPSingle, location1 , www.weonlydo.com , 8000

End Sub

Private Sub vpn2_SearchDone(ByVal IP As String, ByVal Port As Long, ByVal ErrorCode As Long, ByVal ErrorText As String)

If ErrorCode <> 0 Then
Debug.Print SearchDone Event error: & ErrorText
Else
Debug.Print Search done
Debug.Print IP: & IP & Port: & Port
vpn2.Connect IP, Port
End If

End Sub

Private Sub vpn2_Connected(ByVal PeerID As String, ByVal IP As String, ByVal Port As Long)
Debug.Print CONNECTED to & IP & (on port & Port & )
End Sub
[/code]

Let us know how it goes.


Regards,
Drazen

Re: VPN Working

by Zeeshan Alam, Saturday, October 06, 2007, 11:40 (6256 days ago) @ woddrazen

Hello,

Thanks for all your help and support so far.

I tried and figured out how to work with it and am very excited about it. There seem to be one problem, whether tried on same PC or between two remote PCs, the problem is:-

In the sample only, When you click Search button, it starts looking for the Remote PC but will time out, but if at the same time we click the Search button from the Remote PC, it will instantly connect. So basically, is it so that both the PCs must be searching for each other to initially connect?

Thanks and regards,
Zeeshan Alam
Retina-X Studios, LLC
www.retinaxstudios.com

Re: VPN Working

by woddrazen, Saturday, October 06, 2007, 12:46 (6256 days ago) @ Zeeshan Alam

Hi Alam,


Yes, both sides should search for each other to initial connection.

Why don't you use RetryCount Property and set the value to 0. In that case Search will retry forever and you can always connect to other side.

More help for RetryCount Property you can find here:
http://www.weonlydo.com/VPN/Help/WODVPNLib~wodVPN~RetryCount.html


Drazen

Re: VPN Working

by Zeeshan Alam, Sunday, October 07, 2007, 18:10 (6255 days ago) @ woddrazen

Hi,

Thanks a lot. I am very close: two small questions:-

1. When PC A is searching for PC B, and PC B for A they can connect fine. At same time, PC C is searching for A, do A also need to be searching for C?

2. I was just happy using SendData but since the manual recommends to use port forwarding instead, throwing a little light on it would be very much helpful.

Thank you,
Zeeshan Alam

Re: VPN Working

by woddrazen, Sunday, October 07, 2007, 19:13 (6255 days ago) @ Zeeshan Alam

Alam,


1) Yes, PC A should search also for PC C.

To establish two connections (from for example PC A to PC B and PC C) you should make two instance of wodVPN. One instance will connect to PC B and other one to PC C.

2) For port forwarding you should use wodVPN Channel Object - Add Method.

In Add Method you can decide which port type you want to use: TCP or UDP and which type of port forwarding you want to use; local port forwarding or remote port forwarding.

Here is example for LocalListen:
------------------------------
vpn1.Channels.Add TCPLocalListen, 127.0.0.1 , 81, 127.0.0.1 , 80
------------------------------

In this case wodVPN will forward remote port 80 to local port 81. You can now open IE and connect to http://127.0.0.1:81 and you will receive remote port 80. This is only possible if there is something on remote side on port 80.

More help for Add Method you can find here:
http://www.weonlydo.com/VPN/Help/WODVPNLib~VPNChannels~Add.html

Let us know how it goes.


Drazen

Re: VPN Working

by wodSupport, Sunday, October 07, 2007, 19:19 (6255 days ago) @ woddrazen

Usign SendData is ok if you have smaller amount of data to send. But there's no mechanism inside to give you idea of when/how data sent, and when it's ok to send more data. Sockets provide all of this, and that's why we suggested using sockets.

You can of course use SendData if you wish. If data cannot be delivered, yuo will get teh error and should try later to send same data.

Kreso

Re: VPN Working

by Shawn Campbell, Friday, September 26, 2014, 18:38 (3709 days ago) @ woddrazen

I'm trying to add this feature in..


        Try
            VPN2 = New wodVPNCom
            VPN2.LicenseKey = "xxxxx"
            VPN2.Channels.Add(ChannelTypesEnum.TCPLocalListen, "0.0.0.0", 90, "google.com", 80)
            VPN2.Start(0)

            MsgBox("run portscan on port 90")
        Catch ex As Exception
            MsgBox(ex.Data)
        End Try

Nothing is happening.. please help.

Re: VPN Working

by wodSupport, Friday, September 26, 2014, 18:51 (3709 days ago) @ Shawn Campbell

Shawn,

you should connect two wodVPN peers to make channel redirection to work.

Kreso