Re: VPN Working - WeOnlyDo Discussion board

Re: VPN Working (General questions)

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


Complete thread: