EndReceiveMessageFrom() public method

public EndReceiveMessageFrom ( IAsyncResult asyncResult, SocketFlags &socketFlags, EndPoint &endPoint, IPPacketInformation &ipPacketInformation ) : int
asyncResult IAsyncResult
socketFlags SocketFlags
endPoint System.Net.EndPoint
ipPacketInformation IPPacketInformation
return int
コード例 #1
0
        public static Task <SocketReceiveMessageFromResult> ReceiveMessageFromAsync(
            this Socket socket,
            ArraySegment <byte> buffer,
            SocketFlags socketFlags,
            EndPoint remoteEndPoint)
        {
            return(Task <SocketReceiveMessageFromResult> .Factory.FromAsync(
                       (callback, state) => socket.BeginReceiveMessageFrom(
                           buffer.Array,
                           buffer.Offset,
                           buffer.Count,
                           socketFlags,
                           ref remoteEndPoint,
                           callback,
                           state),
                       asyncResult => {
                IPPacketInformation ipPacket;
                int bytesReceived = socket.EndReceiveMessageFrom(
                    asyncResult,
                    ref socketFlags,
                    ref remoteEndPoint,
                    out ipPacket);

                return new SocketReceiveMessageFromResult()
                {
                    PacketInformation = ipPacket,
                    ReceivedBytes = bytesReceived,
                    RemoteEndPoint = remoteEndPoint,
                    SocketFlags = socketFlags
                };
            },
                       null));
        }
コード例 #2
0
 int Utils.Wrappers.Interfaces.ISocket.EndReceiveMessageFrom(System.IAsyncResult asyncResult, ref SocketFlags socketFlags, ref System.Net.EndPoint endPoint, out System.Net.Sockets.IPPacketInformation ipPacketInformation)
 {
     return(InternalSocket.EndReceiveMessageFrom(asyncResult, ref socketFlags, ref endPoint, out ipPacketInformation));
 }