@ Override public void sendMenuCommand ( MenuCommand msg ) throws IOException { if ( isConnected ( ) ) { synchronized ( outputBuffer ) { cmdBuffer . clear ( ) ; protocol . toChannel ( cmdBuffer , msg ) ; cmdBuffer . flip ( ) ; outputBuffer . clear ( ) ; outputBuffer . put ( START_OF_MSG ) ; outputBuffer . put ( protocol . getKeyIdentifier ( ) ) ; outputBuffer . put ( cmdBuffer ) ; outputBuffer . flip ( ) ; logByteBuffer ( "Sending message on " + getConnectionName ( ) , outputBuffer ) ; sendInternal ( outputBuffer ) ; outputBuffer . clear ( ) ; } } else { throw new IOException ( "Not connected to port" ) ; } }
Sends a command to the remote with the protocol and usual headers .