How to build RakNet as a plugin for UE4 so it can be used with blueprints ?

For plugin info:

UE4 got common interface for all online services and solutions called OnlineSubsystem:

https://docs.unrealengine.com/latest/INT/API/Runtime/OnlineSubsystem/index.html
https://docs.unrealengine.com/latest/INT/API/Runtime/OnlineSubsystem/Interfaces/index.html

You need to plug RakNet in to that interface and engine conna support it seemlessly, even some games may work without much touch.I don’t really know how to exactly do it and there really lack of documention on OnlineSubsystem, so you will need to look up existing implementation for SteamWorks, Google Plus, iOS game thing or even Facebook. You can find all of them here (PSN and Xbox Live is missing as they under NDA):

I also not sure if this will work with plugins, if not can always paste code to project.

As for Blueprint, only those parts of OnlineSubsystem is exposed:

For more you need to expose those features yourself, or wait for Epic to do it