I have an IMac and created a self assigned wifi to print to my computer. It disconnects every time it enters sleep mode and i have to log on and connect. Just got an iPhone and lose my FaceTime and other apps too.
Are you saying you're running the iMac as a wifi hotspot (like an ad hoc network) or are you saying something else. If you'd like to keep the Mac from going to sleep you should check out Caffeine in the app store(free). It will keep it from sleeping and your internet and other services will run.