Is there a way to simulate a waiting epoll call with EOS_P2P_ReceivePacket ?

Hello,

I’m migrating some old networking code to EOS. The issue I’ve run into is that we have all networking on a separate thread working with old school poll calls which have a timeout parameter. Is there a way to achieve this with EOS_P2P_ReceivePacket or EOS_P2P_GetNextReceivedPacketSize ? I’ve looked into the eos_p2p.h header but there seems to be no waiting function or signal.

I can trigger some semaphores from inside the EOS wrapping calls and send those incoming messages to the working thread but it will add a layer of complexity to the code I would rather be without.

Hello, sorry for the really long delay. The SDK isn’t thread-safe; you’ll need to make sure all EOS SDK API calls are made from the same thread, and we recommend doing these on the main thread. There’s no polling functionality in the SDK. Packets are received by the SDK and fill an internal queue. Your game needs to call EOS_P2P_ReceivePacket to move packets from the internal SDK queue to your game. We recommend calling EOS_P2P_ReceivePacket frequently to prevent the SDK queue from filling to avoid packet loss.