[fix]修正UdpServer在接收广播时连续启动接收的错误,在StarAgent中,此时可能收到广播包,SocketFlags是Broadcast,需要清空,否则报错“参考的对象类型不支持尝试的操作”; 无需设置SocketOptionName.PacketInformation,在ReceiveMessageFromAsync时会自动设置,并且支持ipv6;
石头
编写于
2024-10-10 00:36:00
石头
提交于
2024-10-10 00:45:43
X
#if __WIN__
using System;
using System.ComponentModel;
using System.IO.Ports;
using System.Text;
using System.Xml.Serialization;
using NewLife.Xml;
namespace NewLife.Net
{
/// <summary>串口配置</summary>
[XmlConfigFile("Config\\Serial.config")]
public class SerialPortConfig : XmlConfig<SerialPortConfig>
{
/// <summary>串口名</summary>
[Description("串口名")]
public String PortName { get; set; } = "COM1";
/// <summary>波特率</summary>
[Description("波特率")]
public Int32 BaudRate { get; set; } = 115200;
/// <summary>数据位</summary>
[Description("数据位")]
public Int32 DataBits { get; set; } = 8;
/// <summary>停止位</summary>
[Description("停止位 None/One/Two/OnePointFive")]
public StopBits StopBits { get; set; } = StopBits.One;
/// <summary>奇偶校验</summary>
[Description("奇偶校验 None/Odd/Even/Mark/Space")]
public Parity Parity { get; set; } = Parity.None;
/// <summary>文本编码</summary>
[XmlIgnore]
public Encoding Encoding { get; set; } = Encoding.UTF8;
/// <summary>编码</summary>
[Description("编码 gb2312/us-ascii/utf-8")]
public String WebEncoding { get { return Encoding.WebName; } set { Encoding = Encoding.GetEncoding(value); } }
/// <summary>十六进制显示</summary>
[Description("十六进制显示")]
public Boolean HexShow { get; set; }
/// <summary>十六进制自动换行</summary>
[Description("十六进制自动换行")]
public Boolean HexNewLine { get; set; }
/// <summary>十六进制发送</summary>
[Description("十六进制发送")]
public Boolean HexSend { get; set; }
/// <summary>最后更新时间</summary>
[Description("最后更新时间")]
public DateTime LastUpdate { get; set; }
/// <summary>扩展数据</summary>
[Description("扩展数据")]
public String Extend { get; set; } = "";
/// <summary>DtrEnable</summary>
[Description("DtrEnable")]
public Boolean DtrEnable { get; set; } = false;
/// <summary>RtsEnable</summary>
[Description("RtsEnable")]
public Boolean RtsEnable { get; set; } = false;
/// <summary>BreakState</summary>
[Description("BreakState")]
public Boolean BreakState { get; set; } = false;
}
}
#endif
|