Imports System.ServiceModel Imports System.Xml Public Class Channel Public Shared Function GetBinding(Optional AuthenticationMode As TcpClientCredentialType = TcpClientCredentialType.Windows) As NetTcpBinding Return New NetTcpBinding() With { .MaxReceivedMessageSize = Constants.MAX_RECEIVED_MESSAGE_SIZE, .MaxBufferSize = Constants.MAX_BUFFER_SIZE, .MaxBufferPoolSize = Constants.MAX_BUFFER_POOL_SIZE, .MaxConnections = Constants.MAX_CONNECTIONS, .TransferMode = TransferMode.Streamed, .Security = New NetTcpSecurity() With { .Mode = SecurityMode.Transport, .Transport = New TcpTransportSecurity() With { .ClientCredentialType = AuthenticationMode } }, .ReaderQuotas = New XmlDictionaryReaderQuotas() With { .MaxArrayLength = Constants.MAX_ARRAY_LENGTH, .MaxStringContentLength = Constants.MAX_STRING_CONTENT_LENGTH } } End Function End Class