introducing common.c file, this file includes common function readall() and sendall()