Transmit i2c word data

Hello, all.
I am trying to use Arduino as i2c slave device using Wire.h library.
I can send the data to Arduino with no problem, the code:

void receiveData(int byteCount) 
{  
  String requestCommand = "";
  while(Wire.available())
  { 
    byte lastCommand = (char)Wire.read();
    requestCommand = requestCommand + (char)lastCommand;
  }
  Serial.print("Received: ");
  Serial.println(requestCommand);
  digitalWrite(ledPin, !digitalRead(ledPin));
}

works just fine.
However, I am trying also to communicate back and I’d like to send 16bit value.
For this, I used a linux shell command such as

i2cget -y 0 0x40 0 w

(get data from i2c bus 0, device 0x40, address 0, word data)
The problem is, that the code:

void sendData()
{ 
  Serial.print("Reply: ");
  Serial.println(answer);
  
  Wire.write(answer);
  answer--;
}

refuses to write anything back - I would get only message Error: Read failed.
If I use i2cget -y 12 0x40 0 c, the answer is OK, but only 8bit.
Also, using standard i2c read byte mode (b) i2cget -y 12 0x40 0 b ends up with the same error message as w.
I am lost - I googled for 2-3 hours to find examples of arduino as slave returning 16bit value to i2cget, but no luck so far :frowning:
Can someone, please, point me to the right direction?

I think a bit of detail is missing here

How are you communicating with the Arduino via these shell commands?

Are you connected to a separate Linux machine or are you using a YUN or something ?

You can send and receive words using arduino.

Sorry forbthe missing details - I was searching net for multiple hours at that time and was pretty tired. To communicate, I use i2c-tiny-usb device. The bus already has MCP23017 working just fine for a few months. All communition is done using i2c-tools from openwrt distribution installed on TP-Link MR-3020 router. Hope this helps...

@michinyon: can you, please, elaborate on this? Some examples, perhaps? Thanks.