Imports Microsoft.VisualBasic
Imports System.Runtime.Remoting.Channels

Public Class Channels
  Public Shared Sub RegisterChannels()
    Dim prop As IDictionary
    Dim objChannel As Http.HttpChannel
    Try
      'Reg channel only when one is not registered.
      If ChannelServices.RegisteredChannels.Length = 0 Then
        prop = New Hashtable()
        prop("name") = "Channel1"
        'prop("port") = "0"

        objChannel = New Http.HttpChannel(prop, New BinaryClientFormatterSinkProvider(), New BinaryServerFormatterSinkProvider())
        ChannelServices.RegisterChannel(objChannel, False)
      End If
    Catch ex As Exception
      Throw ex
    Finally
    prop = Nothing
      If Not prop Is Nothing Then
        prop = Nothing
      End If
      objChannel = Nothing
      If Not objChannel Is Nothing Then
        objChannel = Nothing
      End If
    End Try

  End Sub
End Class
