Gets and sends key on start of loop.

- Sends key at appropriate time
- Gets ip as a string instead of pref.