networking code: implemented 'receive'