implementation of communication protocol + non-blocking socket in writing