Send and Scan IBeacons in same sketch

It' possible to scan and send IBeacons using the sams sketch??

not simultaneously but sending, for examples, 5 beacon packets, scanning the near beacons for 5 seconds e so on

I have tried but without success

thanks

Luca

Can you post your code you have so far? Please use code tags.

Could you describe a bit why you want to do this? When you switch roles there is a good chance of missing each other.