NetworkBaseReceiveByMessageAsync 方法 |
接收一条完整的 数据内容,需要指定超时时间,单位为毫秒。
Receive a complete data content, Need to specify a timeout period in milliseconds
命名空间:
HslCommunication.Core.Net
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 protected virtual Task<OperateResult<byte[]>> ReceiveByMessageAsync(
Socket socket,
int timeOut,
INetMessage netMessage,
Action<long, long> reportProgress = null
)
Protected Overridable Function ReceiveByMessageAsync (
socket As Socket,
timeOut As Integer,
netMessage As INetMessage,
Optional reportProgress As Action(Of Long, Long) = Nothing
) As Task(Of OperateResult(Of Byte()))
protected:
virtual Task<OperateResult<array<unsigned char>^>^>^ ReceiveByMessageAsync(
Socket^ socket,
int timeOut,
INetMessage^ netMessage,
Action<long long, long long>^ reportProgress = nullptr
)
abstract ReceiveByMessageAsync :
socket : Socket *
timeOut : int *
netMessage : INetMessage *
?reportProgress : Action<int64, int64>
(* Defaults:
let _reportProgress = defaultArg reportProgress null
*)
-> Task<OperateResult<byte[]>>
override ReceiveByMessageAsync :
socket : Socket *
timeOut : int *
netMessage : INetMessage *
?reportProgress : Action<int64, int64>
(* Defaults:
let _reportProgress = defaultArg reportProgress null
*)
-> Task<OperateResult<byte[]>>
参数
- socket
- 类型:System.Net.SocketsSocket
网络的套接字 - timeOut
- 类型:SystemInt32
超时时间,单位:毫秒 - netMessage
- 类型:HslCommunication.Core.IMessageINetMessage
消息的格式定义 - reportProgress (Optional)
- 类型:SystemActionInt64, Int64
接收消息的时候的进度报告
返回值
类型:
TaskOperateResultByte带有是否成功的byte数组对象
参见