点击或拖拽改变大小

IRobotNetLogNet 属性

组件的日志工具,支持日志记录,只要实例化后,当前网络的基本信息,就以DEBUG等级进行输出
The component's logging tool supports logging. As long as the instantiation of the basic network information, the output will be output at DEBUG

命名空间:  HslCommunication.Core.Net
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
ILogNet LogNet { get; set; }

属性值

类型:ILogNet
备注
只要实例化即可以记录日志,实例化的对象需要实现接口 ILogNet ,本组件提供了三个日志记录类,你可以实现基于 ILogNet 的对象。
示例
如下的实例化适用于所有的Network及其派生类,以下举两个例子,三菱的设备类及服务器类
LogNet示例
// 设备连接对象的日志
MelsecMcNet melsec = new MelsecMcNet( "192.168.0.100", 6000 );

// 举例实现日志文件为单日志文件
melsec.LogNet = new HslCommunication.LogNet.LogNetSingle( "D://123.txt" );
LogNet示例
// 一般服务器对象的
NetSimplifyServer simplifyServer = new NetSimplifyServer( );
simplifyServer.LogNet = new HslCommunication.LogNet.LogNetSingle( "D://log.txt" );
simplifyServer.ReceiveStringEvent += ( HslCommunication.Core.Net.AppSession session, HslCommunication.NetHandle handle, string data ) =>
{
    simplifyServer.SendMessage( session, handle, "Back:" + data );
};
simplifyServer.ServerStart( 45678 );
参见