public TcpServerPort(PortConfig portConfig, IPPortEndpointConfig serverPortEndpointConfig) : base(portConfig, new IPPortEndpointConfig("", new IPEndPoint(IPAddress.None, 0)), "TcpServerPort") { serverEPConfig = serverPortEndpointConfig; PortBehavior = new PortBehaviorStorage() { DataDeliveryBehavior = DataDeliveryBehavior.ByteStream, IsNetworkPort = true, IsServerPort = true }; }
public TcpClientPort(PortConfig portConfig, IPPortEndpointConfig ipPortEndpointConfig, string className) : base(portConfig, className) { targetEPConfig = ipPortEndpointConfig; PortBehavior = new PortBehaviorStorage() { DataDeliveryBehavior = DataDeliveryBehavior.ByteStream, IsNetworkPort = true, IsClientPort = true }; PrivateBaseState = new BaseState(false, true); PublishBaseState("object constructed"); }
public static bool TryParse(ref Utils.StringScanner specScanRef, out IPPortEndpointConfig ipPortEndpointConfig) { Utils.StringScanner specScan = specScanRef; string ec = null; string elementName = null; string addrAttribValue = string.Empty; int portAttribValue = 0; IPAddress ipAddr = null; if (!specScan.MatchToken("<", true, false) || !specScan.ExtractToken(out elementName, TokenType.AlphaNumeric, false, true, false)) { ec = Utils.Fcns.CheckedFormat("Could not find element name in SpecStr:'{0}'", specScan.Str); } else if (specScan.Rest.StartsWith("addr=") && !specScan.ParseXmlAttribute("addr", out addrAttribValue)) { ec = Utils.Fcns.CheckedFormat("Could not extract addr attribute from SpecStr:'{0}'", specScan.Str); } else if (!specScan.ParseXmlAttribute("port", out portAttribValue)) { ec = Utils.Fcns.CheckedFormat("Could not extract port attribute from SpecStr:'{0}'", specScan.Str); } else if (!specScan.MatchToken("/>", true, false)) { ec = Utils.Fcns.CheckedFormat("Did not find expected element end in SpecStr:'{0}'", specScan.Str); } else if (!CannedIPAddresses.TryGetValue(addrAttribValue ?? String.Empty, out ipAddr) && !IPAddress.TryParse(addrAttribValue, out ipAddr)) { ec = Utils.Fcns.CheckedFormat("valid IPAddress could not be extracted from addr attribute:'{0}' in SpecStr:'{1}'", addrAttribValue, specScan.Str); } if (ec == null) { // successfull parse ec = string.Empty; specScanRef = specScan; } if (ipAddr == null) { ipAddr = IPAddress.None; } ipPortEndpointConfig = new IPPortEndpointConfig(elementName, new IPEndPoint(ipAddr, portAttribValue), ec); return(ipPortEndpointConfig.IsValid); }
public static IPort CreateTcpServerPort(PortConfig portConfig, IPPortEndpointConfig ipPortEndpointConfig) { return new TcpServerPort(portConfig, ipPortEndpointConfig); }
public TcpClientPort(PortConfig portConfig, IPPortEndpointConfig ipPortEndpointConfig) : this(portConfig, ipPortEndpointConfig, "TcpClientPort") { }
public static bool TryParse(ref Utils.StringScanner specScanRef, out IPPortEndpointConfig ipPortEndpointConfig) { Utils.StringScanner specScan = specScanRef; string ec = null; string elementName = null; string addrAttribValue = string.Empty; int portAttribValue = 0; IPAddress ipAddr = null; if (!specScan.MatchToken("<", true, false) || !specScan.ExtractToken(out elementName, TokenType.AlphaNumeric, false, true, false)) { ec = Utils.Fcns.CheckedFormat("Could not find element name in SpecStr:'{0}'", specScan.Str); } else if (specScan.Rest.StartsWith("addr=") && !specScan.ParseXmlAttribute("addr", out addrAttribValue)) { ec = Utils.Fcns.CheckedFormat("Could not extract addr attribute from SpecStr:'{0}'", specScan.Str); } else if (!specScan.ParseXmlAttribute("port", out portAttribValue)) { ec = Utils.Fcns.CheckedFormat("Could not extract port attribute from SpecStr:'{0}'", specScan.Str); } else if (!specScan.MatchToken("/>", true, false)) { ec = Utils.Fcns.CheckedFormat("Did not find expected element end in SpecStr:'{0}'", specScan.Str); } else if (!CannedIPAddresses.TryGetValue(addrAttribValue ?? String.Empty, out ipAddr) && !IPAddress.TryParse(addrAttribValue, out ipAddr)) { ec = Utils.Fcns.CheckedFormat("valid IPAddress could not be extracted from addr attribute:'{0}' in SpecStr:'{1}'", addrAttribValue, specScan.Str); } if (ec == null) { // successfull parse ec = string.Empty; specScanRef = specScan; } if (ipAddr == null) ipAddr = IPAddress.None; ipPortEndpointConfig = new IPPortEndpointConfig(elementName, new IPEndPoint(ipAddr, portAttribValue), ec); return ipPortEndpointConfig.IsValid; }
public static IPort CreateTcpServerPort(PortConfig portConfig, IPPortEndpointConfig ipPortEndpointConfig) { return(new TcpServerPort(portConfig, ipPortEndpointConfig)); }
/// <summary> /// static factory method used to create a UdpClientPort from the given portConfig and ipPortEndpointConfig /// </summary> public static IPort CreateUdpClientPort(PortConfig portConfig, IPPortEndpointConfig ipPortEndpointConfig) { return new UdpClientPort(portConfig, ipPortEndpointConfig); }
/// <summary> /// Standard constructor. Accepts PortConfig and IPPortEndpointConfig (parsed from PortConfig.SpecStr). /// </summary> public UdpClientPort(PortConfig portConfig, IPPortEndpointConfig ipPortEndpointConfig) : base(portConfig, ipPortEndpointConfig, "UdpClientPort") { }
/// <summary> /// static factory method used to create a UdpClientPort from the given portConfig and ipPortEndpointConfig /// </summary> public static IPort CreateUdpClientPort(PortConfig portConfig, IPPortEndpointConfig ipPortEndpointConfig) { return(new UdpClientPort(portConfig, ipPortEndpointConfig)); }