server with multiple clients - WeOnlyDo Discussion board

server with multiple clients (General questions)

by drainey, Wednesday, December 17, 2008, 13:41 (5819 days ago)


I create a datatable with the following columns ...

mTerminals = New DataTable

mTerminals.Columns.Add( Id , System.Type.GetType( System.String ))
mTerminals.Columns.Add( Mac , System.Type.GetType( System.String ))
mTerminals.Columns.Add( VPN , System.Type.GetType( System.Object ))
mTerminals.AcceptChanges()

I populate the datatable with my client, number of clients unkown.

For i = 0 To DT.Rows.Count - 1

Dim NewRow As DataRow = mTerminals.NewRow
NewRow.Item( Id ) = DT.Rows(i).Item( Id ).ToString
NewRow.Item( Mac ) = DT.Rows(i).Item( Mac ).ToString

Dim VPN As WODVPNCOMLib.wodVPNCom = New WODVPNCOMLib.wodVPNCom
AddHandler VPN.Connected, AddressOf Connected
AddHandler VPN.Disconnected, AddressOf Disconnected
AddHandler VPN.VPNRequest, AddressOf VPNRequest

NewRow.Item( VPN ) = VPN
mTerminals.Rows.Add(NewRow)
Next

I start my mediator listening ...

mMediator = New WODVPNCOMLib.wodVPNCom
mMediator.MyID = Mediator
mMediator.Password = anypass...
mMediator.Mediator.Start(SearchEnum.SrchUDPSingle, 1020)


Private Sub mMediator_MediatorConnected(ByVal IP As String, ByVal Port As Integer, ByVal FromID As String, ByVal ToID As String, ByVal Data As String, ByRef Allow As Boolean) Handles mMediator.MediatorConnected

For i As Integer = 0 To mTerminals.Rows.Count - 1

Dim Row as DataRow = mTerminals.Rows(i)
If FromID = Row.Item( Mac ).ToString Then
Dim VPN As WODVPNCOMLib.wodVPNCom = Row.Item( VPN )

VPN.Connect(IP, Port) ' How do I connect client

Exit For
End If

Next

End Sub

Is there some way of getting the mediator to connect these two objects??? ie the external wodVPN client which did the search and found the mediator and the modVPN in my datatable???


Regards


Complete thread: