nxtlib/src/Protocol.cs
/// <summary> 
/// [Native] Write a message to an incoming box on the NXT.
/// </summary>
/// <param name="box">The mailbox to send the message to.</param>
/// <param name="message">The message to send, as a byte array.
///   The array must not be longer than 59 characters and must conclude with '/0'.</param>
[Native] Write a message to an incoming box on the NXT.
[ Native ] Write a message to an incoming box on the NXT .
public void MessageWrite(Mailbox box, byte[] message)
        {
            int messageSize = message.Length + 1;  
            if (messageSize > 59)
            {
                throw new NXTException("Message may not exceed 59 characters.");
            }
            byte[] request = new byte[4 + messageSize];
            request[0] = (byte)(0x00);
            request[1] = (byte)DirectCommand.MessageWrite;
            request[2] = (byte)box;
            request[3] = (byte)messageSize;
            message.CopyTo(request, 4);
            request[request.Length - 1] = 0;
            CompleteRequest(request);
            return;
        }
public void MessageWrite ( Mailbox box , byte [ ] message ) { int messageSize = message . Length + 1 ; if ( messageSize > 59 ) { throw new NXTException ( " " ) ; } byte [ ] request = new byte [ 4 + messageSize ] ; request [ 0 ] = ( byte ) ( 0x00 ) ; request [ 1 ] = ( byte ) DirectCommand . MessageWrite ; request [ 2 ] = ( byte ) box ; request [ 3 ] = ( byte ) messageSize ; message . CopyTo ( request , 4 ) ; request [ request . Length - 1 ] = 0 ; CompleteRequest ( request ) ; return ; }
[Native] Write a message to an incoming box on the NXT.
[ Native ] Write a message to an incoming box on the NXT .
// Add 1 for the 0-byte at the end.
box
Mailbox
The mailbox to send the message to.
The mailbox to send the message to .
message
byte[]
The message to send, as a byte array.
The array must not be longer than 59 characters and must conclude with '/0'.
The message to send as a byte array . The array must not be longer than 59 characters and must conclude with ' / 0 ' .