public UdpSessionlessOutputConnector(string ipAddressAndPort, string outpuConnectorAddress, IProtocolFormatter protocolFormatter, bool reuseAddressFlag, short ttl, bool allowBroadcast, string multicastGroup, bool multicastLoopbackFlag) { using (EneterTrace.Entering()) { Uri anServiceUri; try { anServiceUri = new Uri(ipAddressAndPort, UriKind.Absolute); } catch (Exception err) { EneterTrace.Error(ipAddressAndPort + ErrorHandler.InvalidUriAddress, err); throw; } Uri aClientUri; try { aClientUri = new Uri(outpuConnectorAddress, UriKind.Absolute); } catch (Exception err) { EneterTrace.Error(outpuConnectorAddress + ErrorHandler.InvalidUriAddress, err); throw; } myServiceEndpoint = new IPEndPoint(IPAddress.Parse(anServiceUri.Host), anServiceUri.Port); int aClientPort = (aClientUri.Port < 0) ? 0 : aClientUri.Port; myClientEndPoint = new IPEndPoint(IPAddress.Parse(aClientUri.Host), aClientPort); myOutpuConnectorAddress = outpuConnectorAddress; myProtocolFormatter = protocolFormatter; myReuseAddressFlag = reuseAddressFlag; myTtl = ttl; myAllowBroadcastFlag = allowBroadcast; if (!string.IsNullOrEmpty(multicastGroup)) { myMulticastGroup = IPAddressExt.ParseMulticastGroup(multicastGroup); } myMulticastLoopbackFlag = multicastLoopbackFlag; } }
public UdpSessionlessInputConnector(string ipAddressAndPort, IProtocolFormatter protocolFormatter, bool reuseAddressFlag, short ttl, bool allowBroadcast, string multicastGroup, bool multicastLoopbackFlag) { using (EneterTrace.Entering()) { if (string.IsNullOrEmpty(ipAddressAndPort)) { EneterTrace.Error(ErrorHandler.NullOrEmptyChannelId); throw new ArgumentException(ErrorHandler.NullOrEmptyChannelId); } Uri anServiceUri; try { // just check if the address is valid anServiceUri = new Uri(ipAddressAndPort, UriKind.Absolute); } catch (Exception err) { EneterTrace.Error(ipAddressAndPort + ErrorHandler.InvalidUriAddress, err); throw; } int aPort = (anServiceUri.Port < 0) ? 0 : anServiceUri.Port; myServiceEndpoint = new IPEndPoint(IPAddress.Parse(anServiceUri.Host), aPort); myProtocolFormatter = protocolFormatter; myReuseAddressFlag = reuseAddressFlag; myAllowBroadcastFlag = allowBroadcast; myTtl = ttl; if (!string.IsNullOrEmpty(multicastGroup)) { myMulticastGroup = IPAddressExt.ParseMulticastGroup(multicastGroup); } myMulticastLoopbackFlag = multicastLoopbackFlag; } }