Need Help on UNetConnection

Hello, I am trying to get player IPs when they open the game (I am doing this so beta builds cant be sent out to anyone). I found this and am confused on how to implement it into an empty class, I will be calling in BeginPlay, should I call a function from inside BeginPlay? I am also confused on compiling, do I need to take the needed files from my ue4 build and put them in my project source dir?

Sorry in advance if I didn’t provide enough info, I will add info as requested. I am new to c++ in ue4 and only some background in c++ outside ue4.