Implemented error handling, send/receive/error events.