NetworkBaseToken 属性 |
命名空间: HslCommunication.Core.Net
NetSimplifyClient simplifyClient = new NetSimplifyClient( "127.0.0.1", 12345 ); // 这个toeken需要和服务器的设置的token相匹配才可以 simplifyClient.Token = new Guid( "787f9607-dd7a-4ba7-9f98-769d24de05df" );
private NetSimplifyServer simplifyServer = null; public void TokenServerExample( ) { simplifyServer = new NetSimplifyServer( ); simplifyServer.Token = new Guid( "787f9607-dd7a-4ba7-9f98-769d24de05df" ); simplifyServer.ReceiveStringEvent += SimplifyServer_ReceiveStringEvent; simplifyServer.ServerStart( 12345 ); } private void SimplifyServer_ReceiveStringEvent( HslCommunication.Core.Net.AppSession session, HslCommunication.NetHandle handle, string data ) { // 示例情况,接收到数据后返回消息 simplifyServer.SendMessage( session, handle, "Back:" + data ); }