File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
src/BootstrapBlazor.Server/Components/Samples/Sockets Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 4747 <Pre >// 数据适配器内部使用固定长度数据处理器
4848private readonly DataPackageAdapter _dataAdapter = new(new FixLengthDataPackageHandler(12));
4949
50- _dataAdapter.ReceivedCallBack = async Data =>
50+ _dataAdapter.ReceivedCallback = async Data =>
5151{
5252 // 此处接收到的数据 Data 为完整响应数据
5353} ;</Pre >
Original file line number Diff line number Diff line change 1414 <li >点击 <b >连接</b > 按钮后通过 <code >ITcpSocketFactory</code > 服务实例(<a href =" /socket-factory" target =" _blank" >传送门</a >)创建的 <code >ITcpSocketClient</code > 对象连接到网站模拟 <code >TcpServer</code ></li >
1515 <li >点击 <b >断开</b > 按钮调用 <code >CloseAsync</code > 方法断开 Socket 连接</li >
1616 </ul >
17- <p >使用 <code >ReceivedCallBack </code > 委托获得接收到的数据,可通过 <code >+=</code > 方法支持多个客户端接收数据</p >
18- <Pre >_client.ReceivedCallBack += OnReceivedAsync;</Pre >
17+ <p >使用 <code >ReceivedCallback </code > 委托获得接收到的数据,可通过 <code >+=</code > 方法支持多个客户端接收数据</p >
18+ <Pre >_client.ReceivedCallback += OnReceivedAsync;</Pre >
1919 <p >特别注意如果当前页面对 <code >ISocketClient</code > 实例不销毁时需要继承 <code >IDisposable</code > 或者 <code >IAsyncDisposable</code > 接口,在 <code >Dispose</code > 或者 <code >DisposeAsync</code > 中移除委托,以防止内存泄露</p >
2020 <Pre >private void Dispose(bool disposing)
2121{
2222 if (disposing )
2323 {
2424 if (_client is { IsConnected : true })
2525 {
26- _client .ReceivedCallBack -= OnReceivedAsync ;
26+ _client .ReceivedCallback -= OnReceivedAsync ;
2727 }
2828 }
2929} </Pre >
Original file line number Diff line number Diff line change 22 <p ><code >ITcpSocketFactory</code > 服务仅在 <code >Server</code > 模式下可用</p >
33</Tips >
44
5- <PackageTips Name =" BootstrapBlazor .TcpSocket" />
5+ <PackageTips Name =" Longbow .TcpSocket" />
You can’t perform that action at this time.
0 commit comments