diff --git a/Messaging/Messaging.vbproj b/Messaging/Messaging.vbproj
index 41388910..9ce49a60 100644
--- a/Messaging/Messaging.vbproj
+++ b/Messaging/Messaging.vbproj
@@ -96,6 +96,9 @@
True
+
+
+
diff --git a/Messaging/My Project/AssemblyInfo.vb b/Messaging/My Project/AssemblyInfo.vb
index fea7fb5c..1c0d3e79 100644
--- a/Messaging/My Project/AssemblyInfo.vb
+++ b/Messaging/My Project/AssemblyInfo.vb
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
-
+
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
'
-
-
+
+
diff --git a/Messaging/WCF/Channel.vb b/Messaging/WCF/Channel.vb
new file mode 100644
index 00000000..71a45348
--- /dev/null
+++ b/Messaging/WCF/Channel.vb
@@ -0,0 +1,69 @@
+Imports System.ServiceModel
+Imports System.Xml
+Imports DigitalData.Modules.Base
+Imports DigitalData.Modules.Logging
+
+Namespace WCF
+ Public Class Channel(Of TChannel As IClientChannel)
+ Inherits BaseClass
+
+ Private ReadOnly ChannelFactory As ChannelFactory(Of TChannel)
+
+ Public Event Reconnect As EventHandler
+
+ Public Sub New(pLogConfig As LogConfig, pServerAddress As ServerAddress)
+ MyBase.New(pLogConfig)
+ ChannelFactory = GetChannelFactory(pServerAddress)
+ End Sub
+
+ '''
+ ''' Creates a channel and adds a Faulted-Handler
+ '''
+ ''' A channel object
+ Public Function GetChannel() As TChannel
+ Try
+ Logger.Debug("Creating channel.")
+ Dim oChannel = ChannelFactory.CreateChannel()
+
+ AddHandler oChannel.Faulted, Sub() RaiseEvent Reconnect(Me, Nothing)
+
+ Return oChannel
+ Catch ex As Exception
+ Logger.Error(ex)
+ Throw ex
+ End Try
+ End Function
+
+ '''
+ ''' Creates and returns a channel factory with the supplied name and address
+ '''
+ ''' The service name, will be: net.tcp://ip:port/DigitalData/Services/[name]
+ ''' The service address, in the form of ip address and port
+ '''
+ Private Function GetChannelFactory(pAddress As ServerAddress, Optional pName As String = "Main") As ChannelFactory(Of TChannel)
+ Dim oBinding = GetBinding()
+ Dim oAddress = New EndpointAddress($"net.tcp://{pAddress.Host}:{pAddress.Port}/DigitalData/Services/{pName}")
+ Dim oFactory = New ChannelFactory(Of TChannel)(oBinding, oAddress)
+ Return oFactory
+ End Function
+
+ Public Shared Function GetBinding(Optional AuthenticationMode As TcpClientCredentialType = TcpClientCredentialType.Windows) As NetTcpBinding
+ Return New NetTcpBinding() With {
+ .MaxReceivedMessageSize = Constants.ChannelSettings.MAX_RECEIVED_MESSAGE_SIZE,
+ .MaxBufferSize = Constants.ChannelSettings.MAX_BUFFER_SIZE,
+ .MaxBufferPoolSize = Constants.ChannelSettings.MAX_BUFFER_POOL_SIZE,
+ .TransferMode = TransferMode.Streamed,
+ .Security = New NetTcpSecurity() With {
+ .Mode = SecurityMode.Transport,
+ .Transport = New TcpTransportSecurity() With {
+ .ClientCredentialType = AuthenticationMode
+ }
+ },
+ .ReaderQuotas = New XmlDictionaryReaderQuotas() With {
+ .MaxArrayLength = Constants.ChannelSettings.MAX_ARRAY_LENGTH,
+ .MaxStringContentLength = Constants.ChannelSettings.MAX_STRING_CONTENT_LENGTH
+ }
+ }
+ End Function
+ End Class
+End Namespace
diff --git a/Messaging/WCF/Constants.vb b/Messaging/WCF/Constants.vb
new file mode 100644
index 00000000..3f34b90f
--- /dev/null
+++ b/Messaging/WCF/Constants.vb
@@ -0,0 +1,20 @@
+Namespace WCF
+ Public Class Constants
+ Public Const DEFAULT_SERVICE_PORT = 9000
+
+ '''
+ ''' Infos about MaxBufferSize and MaxBufferPoolSize
+ ''' https://social.msdn.microsoft.com/Forums/vstudio/en-US/d6e234d3-942f-4e9d-8470-32618d3f3212/maxbufferpoolsize-vs-maxbuffersize?forum=wcf
+ '''
+ Public Class ChannelSettings
+ Public Const MAX_RECEIVED_MESSAGE_SIZE = 2147483647 ' 1GB
+ Public Const MAX_BUFFER_SIZE = 104857600 ' 100MB
+ Public Const MAX_BUFFER_POOL_SIZE = 1048576 ' 1MB
+
+ Public Const MAX_CONNECTIONS = 500
+ Public Const MAX_ARRAY_LENGTH = 2147483647
+ Public Const MAX_STRING_CONTENT_LENGTH = 2147483647
+ End Class
+ End Class
+
+End Namespace
diff --git a/Messaging/WCF/ServerAddress.vb b/Messaging/WCF/ServerAddress.vb
new file mode 100644
index 00000000..aa63cac7
--- /dev/null
+++ b/Messaging/WCF/ServerAddress.vb
@@ -0,0 +1,7 @@
+Namespace WCF
+ Public Structure ServerAddress
+ Public Host As String
+ Public Port As Integer
+ End Structure
+
+End Namespace
\ No newline at end of file