First, when you're posting code, the forum has a tool for that. Look on the lines above where you're posting and you'll see a #, if you hover over it, it'll say 'Insert Code". Use that tool to insert code into the post and you'll get a nice box around the code with a scrollbar to go through it with.
Next, Serial.write(0); will write a null to the output. Serial.write is how you send binary out the serial port on IDE version 1 and above. On earlier ones, you can use Serial.print(0,char); So, you're writing a null (zero) out the port and looking for an ascii '0' on the other end.
To make it easier for other folks to understand, something like:
and on the other end:
if (Serial.read() == '0')
would make it easier. Many people don't think about 0 being false and anything else being true. So, in this case subtracting an ascii '0' from the input to give a zero result may obscure your intent such that people overlook it.
Oh, notice how the 'code' tags work?