Skip to main content

P2P

The P2P interface sends packets directly between players, with NAT traversal and Epic relay servers when a direct connection is not possible. Players are addressed by their Product User Id, no IP addresses or open ports are needed.

tip

For normal Unreal replication you don't need these nodes. The EOSCore NetDriver uses P2P for you, see Configuring Online Subsystem. Use the P2P nodes for your own messages, for example chat or a lobby handshake.

Common Nodes​

NodeUse
EOS_P2P_SendPacketSends data to a remote user on a socket name and channel. The first packet opens the connection
EOS_P2P_AddNotifyPeerConnectionRequestCalled when a remote user wants to connect
EOS_P2P_AcceptConnectionAccepts the connection (call it for incoming requests, or before you send to open both ways)
EOS_P2P_GetNextReceivedPacketSize + EOS_P2P_ReceivePacketReads received packets, call it every tick
EOS_P2P_CloseConnection / EOS_P2P_CloseConnectionsCloses one or all connections on a socket
EOS_P2P_AddNotifyPeerConnectionEstablished / Interrupted / ClosedConnection state changes

Settings​

NodeUse
EOS_P2P_QueryNATType + EOS_P2P_GetNATTypeFinds the local NAT type
EOS_P2P_SetRelayControl / EOS_P2P_GetRelayControlAllows, forces or forbids relay servers. Forcing relays hides player IP addresses from each other
EOS_P2P_SetPortRange / EOS_P2P_GetPortRangeLimits the local UDP ports
EOS_P2P_SetPacketQueueSize + EOS_P2P_AddNotifyIncomingPacketQueueFullLimits the packet queues