abstract sending and receiving of data