共用方式為


LocalNetworkGamer.SendData Method (Byte , Int32, Int32, SendDataOptions, NetworkGamer)

Sends a selected portion of a byte array to the specified gamer.

Namespace: Microsoft.Xna.Framework.Net
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public void SendData (
         byte[] data,
         int offset,
         int count,
         SendDataOptions options,
         NetworkGamer recipient
)

Parameters

  • data
    Byte array containing session data.
  • offset
    Offset, in bytes, to the start of the data.
  • count
    Amount, in bytes, of data sent.
  • options
    Enumeration containing data send options.
  • recipient
    Gamer to receive the data packet.

Exceptions

Exception type Condition
ArgumentException The NetworkGamer specified as the recipient does not belong to this network session.
ArgumentNullException data or recipient is null.
ArgumentOutOfRangeException
  • offset must be greater than zero, and no larger than the amount of data available.
  • count must be greater than zero, and offset + count must be no larger than the amount of data available.
ObjectDisposedException The NetworkGamer specified as either the sender or the recipient is no longer valid. The gamer may have left the session.

See Also

Tasks

How To: Send Data

Reference

LocalNetworkGamer Class
LocalNetworkGamer Members
Microsoft.Xna.Framework.Net Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista, Zune