fCraft.Player.SendNow C# (CSharp) Method

SendNow() public method

Send packet to player (not thread safe, sync, immediate). Should NEVER be used from any thread other than this session's ioThread. Not thread-safe (for performance reason).
public SendNow ( Packet packet ) : void
packet Packet
return void
        public void SendNow( Packet packet )
        {
            if ( Thread.CurrentThread != ioThread ) {
                throw new InvalidOperationException( "SendNow may only be called from player's own thread." );
            }
            writer.Write( packet.Data );
            BytesSent += packet.Data.Length;
        }

Usage Example

Example #1
0
 void WritePacket()
 {
     Packet.WriteI16((short)index, data, 1);
     data[1027] = chunkValue;
     player.SendNow(new Packet(data));
     index = 0;
 }
All Usage Examples Of fCraft.Player::SendNow