make onReceive work.

Next TODO is make buffer size 0 or 1;
and close port.